Handling notification messages

Check whether the notification message is received in the foreground.

  1. Add debug logs to the onMessageReceived callback as shown in the quickstart sample.
  2. Connect your test device to your computer and use adb logcat to stream the logs.
  3. Make sure your app is in the foreground when you're sending the notification message.
  4. Send a message with a notification payload.
  5. Check whether the onMessageReceived log is triggered.
Check whether the notification message is received in the background.
  1. Make sure your app is not in the foreground.
  2. Send a message with a notification payload.
  3. A notification should be displayed on the device.
  4. If you're unable to receive background messages, make sure that your app is not force- stopped by running: adb shell pm dump your.package.name | grep stopped. If you see stopped=true, your app is force stopped and will be unable to receive messages. To learn more about restrictions on stopped applications, see Launch controls on stopped applications.

Your next step depends on whether your app is force stopped or not.