-2

I working on application that has to communicate with a server every few minutes, while the app is off, to check if there are new messages for it. If new message is awaylable, a notification must be shown.

For now stick to this workflow: A application starts a background service. A service on start connects to server to check for messages, then sets AlarmManager to activate the same service after few minutes and then service stops itself. And so on.

Have managed to implement something like this, but not sure if this is the best way to go.

1 Answer 1

0

You can implement firebase notification using firebase cloud messaging services. Firebase will send the notification to an application when any message received from app user. So, that will not be required to call continues background services for the check for new messages.

Please check below link for more information : https://firebase.google.com/docs/cloud-messaging/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.