Skip to content Skip to sidebar Skip to footer

Sharing Data Between 2 Android Applications

I have gone through a lot of similar answers, but since a lot of things have changed recently, I wanted to ask it again. I have an application A that stores data in Shared Preferen

Solution 1:

I also read that apps signed with the same key can access each other's code and data

Only via sharedUserId.

Are there any other ways to share the data as well?

You could:

  • Have one app expose a service that the other app starts and passes the data via Intent extras
  • Have one app expose a service that the other app binds to and passes the data via AIDL parameters
  • Have one app send an explicit broadcast Intent to the other app with the data included in Intent extras
  • Have one app start an activity in the other app with the data included in Intent extras

Those options, as with the ContentProvider solution, can be secured by Android's permission system. If you carefully set up a custom permission, with a protectionLevel of signature, those apps will be able to communicate with each other, but other apps will not be able to hack into those communication channels.

And, of course, another option is to just have one app.

Post a Comment for "Sharing Data Between 2 Android Applications"