0

I started developing an app that uses sqlite that is to be installed on multiple devices and any updates done on sqlite database from any device are to be reflected in other devices as well. I have researched a little and found that Sqlite DB is local to a device and changes done in one device are not reflected in others and for that I have to use external server. Is there any way around it? Is it optimal to directly store data in external server or use sqlite and sync it regularly with external database? Thanks in advance

user3794853
  • 55
  • 1
  • 8

2 Answers2

1

As far as I know, there isn't a way without an external database. I would recommend you to sync it regularly with an external database.

Checkout this question for more information how to do that:

Answer of Andrew White

Create a webservice (REST is probably best) and serialize your SQLite/MySQL data and PUT/POST/GET it to/from your web service. This will give you a nice layer of abstraction in case you decide to switch from MySQL to something else server side.

Community
  • 1
  • 1
Bona Fide
  • 714
  • 1
  • 9
  • 33
  • Is it better to directly perform transactions with external DB or use sqlite and sync regularly whenever new data added? – user3794853 Oct 30 '15 at 09:45
  • If you want to synchronize the data from the external database only, lets say each week, then I would go for an internal SQLite DB and synchronize it only every week. But if you want everytime the actual data, then I would recommend you to directly perform the transactions with the external DB to avoid dublicate data you don't need. Keep in mind, that a single database is easier to maintain instead of two different ones to keep constantly and flawlessly in sync. – Bona Fide Oct 30 '15 at 09:58
0

You will achieve your goal using external server. It's not necessary to create your own server, just use data store services like Parse. For more look here.

You can use data directly from external server or cache them on your device first (sqlite, prefs, json etc.) – it's up to you.

lewkka
  • 1,019
  • 15
  • 25