当应用处于Foreground
状态时,我会看到dialog
框,其中包含通知标题和正文。我不想显示此dialog
框。相反,我想使用我自己的dialog
框。我对Push Notification
功能很新,很抱歉,如果这是一个愚蠢的问题。我已经附加了我现在正在获取的dialog
框的示例图像。
这是我的代码
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
Intent intent = new Intent(Cons.INTENT_FILTER);
Bundle bundle = new Bundle();
// some custom data in bundle which I need.
intent.putExtras(bundle);
sendBroadcast(intent);
}
我正在使用BroadcastReceiver
来处理通知
private BroadcastReceiver myReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
}
};
我也在注册和取消注册BroadcastReceiver
。
registerReceiver(myReceiver, new IntentFilter(Cons.INTENT_FILTER));
unregisterReceiver(myReceiver);
答案 0 :(得分:0)
尝试注册/取消注册接收器
IntentFilter filter = new IntentFilter();
filter.addAction(Cons.INTENT_FILTER);
registerReceiver(myReceiver, filter)
// then unregisterReceiver(myReceiver);