Reputation: 2119
I have an app that already is on the market, let's call it "old app". I would like to create a "new app" that shares the data with the old one app I decided to do it using a SharedID.
I changed the manifest of the NEW app adding the following line:
android:sharedUserId="com.myname.myoldapp"
Where com.myname.myoldapp is the name of the old app package. But it does not work.
How can I access with the new app to the old app data? Changing the userId of the old app to match the shareduserid of the new one, is obviously not an option, because the old app is already online and all users that update it would lose their personal data.
PS: the certificates are the same.
Thank you,.
Upvotes: 5
Views: 1603
Reputation: 1006614
I have an app that already is on the market, let's call it "old app". I would like to create a "new app" that shares the data with the old one app I decided to do it using a SharedID.
That will no longer be possible, without breaking all of your existing installations.
I changed the manifest of the NEW app adding the following line: android:sharedUserId="com.myname.myoldapp" Where com.myname.myoldapp is the name of the old app package. But it does not work.
If you read the documentation on android:sharedUserId
, you will see that you are told: "However, if this attribute is set to the same value for two or more applications, they will all share the same ID" (emphasis mine). Since your old app does not have an android:sharedUserId
, you cannot set the new app to the old app's android:sharedUserId
value.
How can I access with the new app to the old app data?
Use a Service
. Or a ContentProvider
. Or any other form of IPC supported by Android. The old app will need to expose an IPC-based API which the new app can use to access the old app's data. You can use custom signature
-level permissions to restrict access to these APIs to just your apps.
Upvotes: 5