My app is running I just screen off the device and no notification event is coming inside FirebaseMessagingService
.
The notification is also not showing in the notification tray. Is that some bug with FCM
or I am doing something wrong.
Please find attached code for FCMService
.
public class FCMService extends FirebaseMessagingService {
private static final Logger LOGGER = LoggerFactory.createLogger(FCMService.class);
@Override
public void onMessageReceived(RemoteMessage message) {
if (null != message) {
onNotificationReceived(message.getNotification(), message.getData());
}
}
/**
* Create and show a simple notification containing the received FCM message.
* @param messageBody FCM message body received.
* @param data Notification Data
*/
private void onNotificationReceived(RemoteMessage.Notification messageBody, final Map<String, String> data) {
LOGGER.info("Notification received... for data %s", data);
if (AppPreferences.getInstance().isUserLogin()) {
if (null != messageBody) {
LOGGER.info("Notification received... Foreground Notification...%");
} else {
LOGGER.info("Notification received... Silent Notification...%");
}
}
}
}