Reputation: 41119
I'm developing a keyboard, so I'm implementing an InputMethodService
. I have a requirement to add other features to this keyboard application but to separate it as another application in order to leave the keyboard as a lone keyboard implementation.
So I need to create a keyboard application and another application with all the other features (other features include but not limited to: a News Activity, a Messenger, a Lock Screen implementation and some Widgets).
Those two applications will need to communicate between them, from my research I found that there are several mechanisms I could use:
My question is: what would be the best implementation for my needs? Where my needs are to pass data from one application to another as well as starts activities and other components from one app in another.
Upvotes: 1
Views: 4005
Reputation: 41119
After I made some research on this topic I found that there are several ways to do this operation:
Using Bounded Services that uses either a Messenger
object to pass messages between the local process and the Remote Bounded Service or using AIDL
to create an interface that will be passed from the Remote Bounded Service to the local process so that they can communicate.
The second options would be using the good old fashion BroadcastReceivers
. That way as always it is possible to fire an Intent from the local process to the remote process and there receive some information.
The different for the usage of those both two would be decided by how strong would you like the connection to be between the two processes and how often should they be communicating. If they need to do one operation once in a while the BroadcastReceivers
would be a perfectly good solution. But if you need a more consistent connection the Bounded Service is the way to go.
Upvotes: 1