通知收到不稳定

时间:2016-10-01 21:18:02

标签: android firebase firebase-cloud-messaging

我遇到了新的firebase通知系统的问题。

有时,该服务运行良好且速度很快,但有时我发送的任何设备都没有收到通知,或者需要很长时间(10分钟到几个小时)。如果我从firebase控制台发送通知或从我的PHP脚本发送数据消息,这没关系。什么都行不通。我将此通知发送到某个主题,但直接发送到令牌也无法正常工作。 控制台显示" 0发送"。

如果我强制该应用停止并重新启动它,有时它可以解决问题并收到新通知。

它不可重复,它非常随机。

是否存在类似已知的问题,或者我是唯一受此问题影响的问题?

这是我的接收代码:

@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
    Log.d("FCM", "From: " + remoteMessage.getFrom());

    if (remoteMessage.getData().size() > 0) {
        new MyNotification(remoteMessage, this).send();

        Log.d("FCM", "Message data payload: " + remoteMessage.getData());
    }

    if (remoteMessage.getNotification() != null) {
        Log.d("FCM", "Message Notification Body: " + remoteMessage.getNotification().getBody());
    }
}

通知构建器(缩写):

Notification notification = new NotificationCompat.Builder(getContext())
                .setContentTitle("Test")
                .setSmallIcon(R.mipmap.ic_launcher)
                .setGroup(GROUP)
                .build();

NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(getContext());
notificationManagerCompat.notify(ID, notification );

0 个答案:

没有答案
相关问题