2

I want to know if the following is possible. I want to create a new Settings App in Android and then another App as well. I want both to use the same database and I do not want to use a content provider.

So I want to know if it would be possible to do this by storing the database on an external SD card? Are there any risks in doing this and can I access the database on the external storage from the Settings App?

Edit: So the other App that I refer to will query a server and get data that will be used to change settings in Android, but this information will be stored in an SQLite database. Then I want the Settings App to access this information and update the various things, so I need to simply know if both this Settings App and the other application will be able to access the SQLite database on external storage without any problems, so that I can achieve what I require? Hope this is a little more clear?

Thanks, Wihan

Wihan Fourie
  • 175
  • 1
  • 4
  • 11
  • That's a good question but your question is a little general. please be more specific and ask about programming problems. ;) – Milad Faridnia Feb 10 '15 at 11:53
  • I believe this is what you are searching http://stackoverflow.com/questions/7053809/share-sqlite-database-between-2-android-apps – MDMalik Feb 10 '15 at 11:56
  • @MDMalik yeah I saw that post, just wanted to make sure that this is possible from a Settings App since I have never written one and not sure if there are any limitations etc. – Wihan Fourie Feb 10 '15 at 12:01

2 Answers2

1

Yes, It is possible

Share database between two apps

But when the first app has been uninstalled, then the database will be deleted

For sharing database you need to add

<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:sharedUserId="my.app" ... >
Community
  • 1
  • 1
Ameer
  • 2,709
  • 1
  • 28
  • 44
0

The database path is private for each application and as far as i know it's not possible to access it directly across applications.

However one approach is that one application makes it's database accessible to the other one using a ContentProvider. Check out if that works for you.

for more read: http://www.skholingua.com/android-basic/android-app-components/content-provider

chiru
  • 635
  • 1
  • 7
  • 14