我的應用程序正在運行我只是屏蔽了設備,並且沒有通知事件進入FirebaseMessagingService
。On Screen Off FCM失去通知
該通知也未顯示在通知托盤中。這是一些與FCM
錯誤或我做錯了什麼。
請發現附件代碼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...%");
}
}
}
}
如果您收到通知時,您的應用程序是在前臺,那麼你應該得到它時,它是在後臺發生火災後通知的應用程序。你使用什麼設備? –