Firebase主题通知未在Android设备上接收

时间:2017-08-24 12:52:42

标签: android firebase firebase-cloud-messaging

我没有收到主题通知。控制台显示其成功发送并返回消息ID,但设备未接收它。一旦我收到单个和主题消息,在我添加一些UI更改后它不接收主题消息。问题是什么?

我正在我的启动器活动onCreate方法上注册该主题。

单个设备通知发送和接收没有问题。

Bellow是我的广播接收者代码。

 mRegistrationBroadcastReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            Log.e("Main activity: ","gcm = "+intent.getAction());
            // checking for type intent filter
            if (intent.getAction().equals(Config.REGISTRATION_COMPLETE)) {
                Log.e("Main activity: ","gcm successfully registered");
                // gcm successfully registered
                // now subscribe to `global` topic to receive app wide notifications
                FirebaseMessaging.getInstance().subscribeToTopic(Config.TOPIC_GLOBAL);


            } else if (intent.getAction().equals(Config.PUSH_NOTIFICATION)) {
                // new push notification is received
                Log.e("Main activity: ","gcm successfully registered 2");
                String message = intent.getStringExtra("message");

                Toast.makeText(getApplicationContext(), "Push notification: " + message, Toast.LENGTH_LONG).show();

                // txtMessage.setText(message);
            }
        }
    };

0 个答案:

没有答案