How to keep the android client connected to the server even on activity changes and send data to server?

The code is right. The only mistake was that I was trying to start the service twice once in onServiceConnected() method and the other in onCreate() method.

I changed my code to start the service only in onCreate() method in the launcher activity. The rest of the activities directly bind to the service by using doBindService() method

Leave a Comment