简体   繁体   English

将相同的SQLitedatabase数据与应用程序中的任何设备一起使用

[英]Using same SQLitedatabase data with any device in application

I tried installing my application to a 2nd Android device and it's not uploading the same database from my original device.For example on the original device I registered a Username into my database and then on the 2nd device I registered a username and the first Username I registered does not show up in the Admin activity I made that shows a list of registered users. 我尝试将我的应用程序安装到第二个Android设备,而不是从我的原始设备上传相同的数据库。例如在原始设备上我将用户名注册到我的数据库中然后在第二个设备上我注册了用户名和第一个用户名我注册不显示在我显示的管理员活动中,显示注册用户列表。

I thought it might of been the fact that the 2nd device I'm using is a Gingerbread version 2.3.4 while my first device is a Jelly Bean 4.2 but I used an emulator using Jelly Bean 4.2 and it wasn't showing the registered usernames of devices 1 and 2. 我认为可能是我使用的第二个设备是Gingerbread版本2.3.4,而我的第一个设备是Jelly Bean 4.2但是我使用了一个使用Jelly Bean 4.2的模拟器并且它没有显示注册的用户名设备1和2。

Is there a way I could make multiple devices share the same database in my application? 有没有办法让我的应用程序中的多个设备共享同一个数据库?

Forgot to include that the 2nd device is registered to a different google account if that makes a different. 忘记包括第二个设备注册到不同的谷歌帐户,如果它有所不同。

Local data cannot arbitrarily be shared between devices. 本地数据不能在设备之间任意共享。 If you want to share the same data, you will need a server to act as a middleman. 如果要共享相同的数据,则需要服务器充当中间人。

In such a scenario, each device will have a local database, which will be synced with your server. 在这种情况下,每个设备都将有一个本地数据库,该数据库将与您的服务器同步。 So whenever a change is made on the device, a corresponding change is made on the server, and the other device then reads the updated database from the server and updates its own local copy. 因此,每当在设备上进行更改时,在服务器上进行相应的更改,然后另一个设备从服务器读取更新的数据库并更新其自己的本地副本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM