Reputation: 608
I have two applications, App A & App B.
App A need to send some data(or communicate to do something) to App B.
What is the best way to do this.
App B can have a broadcast listener to receive the broadcast from App A.
Or I can export a service from App A, so that App B can call startService()
From my experience, broadcast is received very slow, but when calling startService App A is started fast.
Is there is any issues with startService() that App A need to be concerned about with all the background service limitations from Android O.
Upvotes: 1
Views: 75
Reputation: 13009
Is there is any issues with startService() that App A need to be concerned about with all the background service limitations from Android O.
App A should offer an exported Service
which other components can bind to. Then if App B is in the foreground and has started the Service
as a bound Service, the Service
(and with it all of App A) will be considered to be in the foreground as well.
See also the paragraph "Background Service Limitations" in Background Execution Limits for Oreo (App B would be "another foreground app")
Upvotes: 1