私のアプリが実行されています。私はデバイスをスクリーンオフし、通知イベントはFirebaseMessagingService
の中に来ません。オンスクリーンオフ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...%");
}
}
}
}
ようfirebaseからメッセージを取得した後、アプリであなたの火通知をしました。どのようなデバイスを使用していますか? –