[杀死应用程序或在后台时收到fcm通知时自动打开应用程序

问题描述 投票:0回答:1

任何人如何解决此问题,请根据此问题向我发送任何解决方案

已收到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"));
            }
        }
android push-notification firebase-notifications
1个回答
0
投票

您应该像这样在Manifest中声明firebase服务类:

 <service android:name="your_service>
        <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT" />
        </intent-filter>

© www.soinside.com 2019 - 2024. All rights reserved.