任何人如何解决此问题,请根据此问题向我发送任何解决方案
收到fcm通知,但应用未打开如何处理
public void onMessageReceived(RemoteMessage remoteMessage) {
Intent intent = new Intent(INTENT_FILTER);
sendBroadcast(intent);
if (remoteMessage.getData().size() > 0) {
utils.print(TAG, "From: " + remoteMessage.getFrom());
utils.print(TAG, "Notification Message Body: " + remoteMessage.getData());
//Calling method to generate notification
if (SharedHelper.getKey(this,"loggedIn").equalsIgnoreCase(getString(R.string.True))) {
sendNotification(remoteMessage.getData().get("message"));
}
}
答案 0 :(得分:0)
您应该像这样在Manifest中声明firebase服务类:
<service android:name="your_service>
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>