0

I'm developing an Android library and an app. They are supposed to work together like that: the app hosts a String and has several other tasks. The library will be used by third party developers. They should be able to query the installed app (even if it's closed and without opening the GUI of the app) by implementing the library (which does other stuff too). My current solution for this are broadcasts:

  1. The library checks if the app is installed and if so, sends an explicit intent via braodcast (also secured by custom permission, although the shared String isn't even a secret).
  2. The app receives the broadcast and sends an answer broadcast back to the library.

Right now I'm not really shure if that's the best approach. So my question is:

Is there a better way to share simple data between an app and a library that can be used by many apps than using broadcasts?

2
  • 1
    If you want to expose data in your app to 3rd party apps you should look into creating a ContentProvider.
    – Squonk
    Jul 28, 2014 at 20:17
  • When looking for a solution, ContentProviders seemed to have an huge overload for just passing a simple String or am i wrong? But i guess i should have a look into it. Thanks for pointing me in the right direction.
    – Juke
    Jul 28, 2014 at 20:26

1 Answer 1

4

You should use Content Providers.

1
  • 1
    As I already answered Squonk, ContentProviders seem to have an huge overload for just passing a simple String from one app to another. There's no need for the whole implementation as my app would only require to answer to an incoming query. But I'll have a look into it. Thanks!
    – Juke
    Jul 28, 2014 at 20:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.