android设备上未接收Firebase主题通知
我没有收到主题通知。控制台显示其发送成功和返回消息id,但设备未接收该id。一旦我得到了单主题和主题消息,在我添加一些UI更改后,它就不会接收主题消息。问题是什么 我正在我的launcher activity onCreate方法上注册该主题 单设备通知发送和接收没有问题 下面是我的广播接收器代码。android设备上未接收Firebase主题通知,android,firebase,firebase-cloud-messaging,Android,Firebase,Firebase Cloud Messaging,我没有收到主题通知。控制台显示其发送成功和返回消息id,但设备未接收该id。一旦我得到了单主题和主题消息,在我添加一些UI更改后,它就不会接收主题消息。问题是什么 我正在我的launcher activity onCreate方法上注册该主题 单设备通知发送和接收没有问题 下面是我的广播接收器代码。 mRegistrationBroadcastReceiver = new BroadcastReceiver() { @Override public void o
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);
}
}
};
您为什么使用广播接收器?用于接收通知意图?您为什么使用广播接收器?用于接收通知意图