Read Database of ionic app A from ionic app B


#1

Hi guys, :smile:
I have a question,
For example I have two applications the App A and App B.
Is it possible to read the database of App A by App B?
If yes, how ? :smiley:
Help or idea is very much appreciated :smiley:


#2

So, are these two databases stored on the device, such as localstorage or WebSQL? Or are these remote databases, which you access with a server?

If they are remote DB’s (which I highly recommend), and you are running your own server for each app, I would create an endpoint on each server, which can make a request to the other server to retrieve whatever info you need from its respective database.

If these databases are stored on the device, this gets a little tricker, and since each device is running its own DB, you no longer have a centralized DB you can reference. I really would not recommend this approach since everything would be out of sync and identifing which device running App A sent info to a device running App B would get pretty tricky.

The only solution I can think of right now would still be pretty complex and requires two servers and socket.io running on each. This would allow App A to send a request to its server, which would send the request to App B’s server, which could use socket.io to detect if any devices running App B are connected, and then retrieve whatever info you need from App B, send it to App B’s server, which sends it back to App A’s server, which finally delivers it to App A.

See, that is pretty complex and I’m sure its full of holes and errors, such as what if no devices running App B are currently connected? App A can no longer retrieve any information.