2

I have three applications out of which two applications need to connect to a service published by the third application. This service is supposed to send/receive data over GPRS and pass it to both the applications. I have implemented this service as a Messenger Service in the 3rd application. It is mentioned in the android documentation that a Messenger service can be used for communication between two processes but in the same application.My question however is that is it possible to to use a Messenger Service for communication between two processes belonging to two different applications? If yes, could someone show me some sample code demonstrating how a client can bind to such a service.

ShivangSeth
  • 72
  • 1
  • 8
  • I found this [link](http://stackoverflow.com/questions/5485285/can-messenger-lightweight-alternative-to-aidl-be-used-for-cross-application-co) which states that what I am looking to do is possible but I still cannot figure out how to bind to such a service from a client in another application – ShivangSeth May 22 '12 at 15:06

2 Answers2

1

The answer is yes. I'm not sure whether you can explicitily refer to the service class defined in another package, but you definitely can refer to the service via an implicit intent.

A good and concise code sample of this technique can be found here. This particular slide talks about doing IPC ussing Messenger, but the whole presentation is worthwile seeing IMO.

Jose_GD
  • 2,279
  • 1
  • 21
  • 34
0

As per android documentation a Messenger service can be used for communication between two processes but it does not restrict it in same application.Processes can be in same application or different application.

Messenger should be used if we want the requests to be processed sequentially as it enters the messages in handler's queue and they are processed one by one.

Shinoo Goyal
  • 601
  • 8
  • 10