Home » Android » Android, two apps one database?

Android, two apps one database?

Posted by: admin June 15, 2020 Leave a comment

Questions:

We are developing an android app and we want to make two versions, pro and free. The problem is that our apps use a database which we want to be available for both apps.Is it possible?

I mean, the client downloads the free app, and he uses it. Then he decides to buy the pro version, would it be posible to pass the data from free version to pro version?

Thanks

How to&Answers:

you can use a content provider if you want

http://developer.android.com/guide/topics/providers/content-providers.html

Answer:

Two different apps wont be sandboxed from each other and can use the same database provided that they are signed with the same private key and have the same sharedUserId. No need to store the database on a shared folder which might cause breach of sensitive data.

Add:

android:sharedUserId="com.yourprogram"

inside manifest tag in your manifest files and sign both apks with same key. For details:

http://developer.android.com/guide/topics/manifest/manifest-element.html