You can start the service after registration on the server.
onStartCommand of service login the user.
Implement service with PacketListener,ConnectionListener,InvitationListener
PacketListener for Receiving Groupcaht or One to One chat messages.
ConnectionListener to check if connection to the server is connected or disconnected.
InvitationListener For getting Group invitations.
After successful login add these listeners.
Now when the message is received save that message in local database and send a Broadcast for the activities who want the message to be received.
Check if the app is in the background if yes then send the notification for the new message
Mail me if any buddy face any issue cvofjaspreet@gmail.com