Developing two android apps and communicating between two

user1810931 picture user1810931 · Mar 8, 2013 · Viewed 29.4k times · Source

I am developing two applications names A and B.

Application A as activity named MainActivity, service called UpdateService, BroadcastReciever called UpdateReceiver.

Application B as activity named TestActivity, service called DoService, BroadcastReciever called DoReceiver.

In my application B, I want to access few methods and code from MainActivity which is in Application A.

In this way, I need full control of Application A code to access it in my application B.

How can I achieve it?

Answer

iTech picture iTech · Mar 8, 2013

You cannot directly access methods of Activity in different app.

Broadcast would work but if you want more control (i.e. invoke remote methods) consider binding to a remote service in the other app or use Messenger and handler to communicate.

Here is a short tutorial on inter-app communication