Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/181.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 当应用程序被终止解析FCM时无法接收推送_Android_Firebase_Parsing_Push Notification_Firebase Cloud Messaging - Fatal编程技术网

Android 当应用程序被终止解析FCM时无法接收推送

Android 当应用程序被终止解析FCM时无法接收推送,android,firebase,parsing,push-notification,firebase-cloud-messaging,Android,Firebase,Parsing,Push Notification,Firebase Cloud Messaging,我已经更新了parse sdk,这迫使我从GCM迁移到FCM。我关注了以下链接: 当应用程序正在运行或处于后台时,我能够接收推送通知,但当应用程序被终止时,我无法接收推送通知 以下是我的AndroidManifest.xml: <service android:name="com.parse.fcm.ParseFirebaseInstanceIdService" android:exported="true">

我已经更新了parse sdk,这迫使我从GCM迁移到FCM。我关注了以下链接:

当应用程序正在运行或处于后台时,我能够接收推送通知,但当应用程序被终止时,我无法接收推送通知

以下是我的AndroidManifest.xml:

<service
            android:name="com.parse.fcm.ParseFirebaseInstanceIdService"
            android:exported="true">
            <intent-filter>
                <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
            </intent-filter>
        </service>

        <service
            android:name="com.parse.fcm.ParseFirebaseMessagingService">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT"/>
            </intent-filter>
        </service>
        <receiver
            android:name=".receiver.CustomParsePushReceiver"
            android:exported="false">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.intent.action.RECEIVE_BOOT_COMPLETED" />
                <action android:name="android.intent.action.USER_PRESENT" />
                <action android:name="com.parse.push.intent.RECEIVE" />
                <action android:name="com.parse.push.intent.OPEN" />
                <action android:name="com.parse.push.intent.DELETE" />
            </intent-filter>
        </receiver>

我已将parse server、parse sdk、parse fcm、firebase core和firebase messaging更新为最新版本。

您需要为
com.parse.ParsePushBroadcastReceiver配备一个单独的接收器

将您的其他操作(如Boot_Complete)放在单独的接收器上

<receiver
    android:name="com.parse.ParsePushBroadcastReceiver"
    android:exported="false">
    <intent-filter>
        <action android:name="com.parse.push.intent.RECEIVE" />
        <action android:name="com.parse.push.intent.DELETE" />
        <action android:name="com.parse.push.intent.OPEN" />
    </intent-filter>
  </receiver>

当应用程序被终止时,一些存储ROM会终止所有后台进程。因此,推送服务被终止,当应用程序终止时,我无法接收推送。其中一些制造商包括OnePlus、联想、Xiomi、Oppo和维梧。但当我在其他设备上测试时,比如HTC和三星,它成功了


有关更多信息,请阅读本博客:

推送消息的优先级(正常或高)。当收到推送通知时,您是否有一些FJD或JobIntentService来唤醒应用程序?检查并将您的代码发布到.receiver.customparsepushreceiver我刚刚登录customparsepushreceiver应用下面的答案,它会工作的
<receiver
    android:name="com.parse.ParsePushBroadcastReceiver"
    android:exported="false">
    <intent-filter>
        <action android:name="com.parse.push.intent.RECEIVE" />
        <action android:name="com.parse.push.intent.DELETE" />
        <action android:name="com.parse.push.intent.OPEN" />
    </intent-filter>
  </receiver>