How to deal with the need for interprocess communication in my Android application?

My application requires me to periodically do the following:

  • Send periodic heart rate information to the server every 15 seconds
  • Periodically capture the screen and send them to the server once every 60 seconds
  • Send a message and poll the server for messages every 5 seconds

I wrote services for each of the above elements, but here I need help, the connection between these services ...

The heartbeat service should be able to:

  • Get information from the screen capture service.
  • Message queue using the messaging service.

The screen capture service should be able to do the following:

  • Get current activity from my application
  • Message queue using the messaging service.

The messaging service should be able to do the following:

  • Receiving messages in the queue for sending to the server from my application / services
  • Send messages received from the server to the application

With all the necessary communication paths, I wonder how to do this? Can I just bind my application to all services? Link services to other services? Use any other way of communication?

I need all these services to continue to work / work, even if my application is not in the foreground.

+8
android android-service android-service-binding
source share
1 answer

Provided more chat information , but overall craving:

  • use AlarmManager to schedule broadcast receiver calls.
  • allows relay receiver on call
  • let the recipient send a command to the service (this will start the service if it does not start)
  • let the service rotate the flow
  • make HTTP in a stream
+4
source share

All Articles