2

I've a requirement that for my two signed app with same certificates are installed in android device. If there is any thing change app A, app B should be notify for same and vise-versa. Is it possible to get it done anyways?

Thanks

Pankaj
  • 833
  • 12
  • 35
  • Have you looked at this? https://developer.android.com/training/sharing/send.html – Jaxian Jun 20 '16 at 10:17
  • Hi Jaxian, Sharing data between both app will not intent to send. It should working sharing common data. – Pankaj Jun 20 '16 at 10:19

2 Answers2

0

You could study a bit and use Android Content Provider and Android Content Resolver

lubilis
  • 3,942
  • 4
  • 31
  • 54
  • Yeah, I agree to use Android Content Provider, even I had a better solution that I can use the shared preference and save in app A and to read in app B, using code Context con = createPackageContext("com.xyz.data", 0); But there will always be a security concern for app data. In content provider, we can't restrict to other app to read data if it's exported = true. Is it not? – Pankaj Jun 20 '16 at 10:38
  • You're right, your app could have its own permission and its internal logic to share data between providers. If exported = true another app with the installed permission could potentially read your app's data. – lubilis Jun 21 '16 at 22:12
0

Every app package is run as a Linux process several app packages may run as part of one process Use android:sharedUserId in manifest of 2 apps to run them as part of the same larger application

Both apps must be signed with the same certificate App2 wants to read data from app1 so it needs installation information of App1

Get the Package Manager using getPackageManager() of Context class Package Manager contains various kinds of information related to the application packages that are currently installed on the device Call ApplicationInfo

getApplicationInfo(String packageName,int flags)

of package manager to retrieve all of the information about app 1

Swanand Keskar
  • 1,023
  • 1
  • 13
  • 27
  • Data I want to share to be stored dynamically either in variables or shared preference/db. Do you mean that defining android:sharedUserId will provide security regarding access that no other app can use preferences etc even If we know package name of app? Using below code, I can get context and then can be fetch stored db or preference. Context con = createPackageContext("com.xyz.data", 0) – Pankaj Jun 20 '16 at 12:01
  • other app will not have the same sharedUser id ,so it cant get access to data Assuming ur storing data in a file using FileOutputStream Now both App A and App B have the same sharedUserId so they can access the data other apps cant – Swanand Keskar Jun 20 '16 at 15:32