Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access another app's data with sharedUserId

Tags:

android

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,.

like image 896
Beppi's Avatar asked Mar 21 '13 12:03

Beppi's


People also ask

Can apps access other apps data?

More than 4,000 Google Play apps silently collect a list of all other installed apps in a data grab that allows developers and advertisers to build detailed profiles of users, a recently published research paper found.

Can Android Apps access other apps data?

Stay organized with collections Save and categorize content based on your preferences. Just as an app can send data to other apps, it can also receive data from other apps as well. Think about how users interact with your application and what data types you want to receive from other applications.

How do you share data between two apps?

Android uses the action ACTION_SEND to send data from one activity to another, even across process boundaries. You need to specify the data and its type. The system automatically identifies the compatible activities that can receive the data and displays them to the user.


1 Answers

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.

like image 180
CommonsWare Avatar answered Sep 26 '22 00:09

CommonsWare