Apparently you can share permission to system resources like protected
database files by using the sharedUserId attribute in manifest files.
Here are manifests from two apps that I have that are intented to
share access to a common database.

<manifest xmlns:android="http://schemas.android.com/apk/res/android";
      package="com.my.appA"
      android:sharedUserId="com.my.sharedid"
      android:versionCode="1"
      android:versionName="1.0">


<manifest xmlns:android="http://schemas.android.com/apk/res/android";
      package="com.my.appB"
      android:sharedUserId="com.my.sharedid"
      android:versionCode="1"
      android:versionName="1.0">


The database code is slightly different in each app. The database
properly belongs to appA, so it uses the standard conventions for
creating and opening the database. But appB must do something
different. It looks in the absolute path where the database file
should be:

db = SQLiteDatabase.openDatabase("/data/data/com.my.appA/databases/
mydatabase", null, 0);


I have tried this with success in the emulator, but it fails on a
physical device with
ERROR/AndroidRuntime(17235): Caused by:
android.database.sqlite.SQLiteException: unable to open database file

I am using the debug key to sign the packages, but from what I
understand that shouldn't matter because the keys for both apps still
match.

Is there something I'm missing? Why does this work on the emulator but
not on a Droid?

Thanks for any advice,
Warren

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to