这个。从Firebase发送通知时,不会调用MyFirebaseMessagingService。这是我的代码。我有MyFirebaseInstanceIDService并且可以正常工作。
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
String from = remoteMessage.getFrom();
Log.d(TAG, "Mensaje recibido: " + from);
if (remoteMessage.getNotification() != null) {
Log.d(TAG, "Notificacion: " + remoteMessage.getNotification().getBody());
mostratNotificacion(remoteMessage.getNotification().getTitle(), remoteMessage.getNotification().getBody());
}
if (remoteMessage.getData().size() > 0) {
Log.d(TAG, "Data: " + remoteMessage.getData());
}
}
这是我的清单