应用程序被终止时Android中的FCM通知

应用程序被终止时Android中的FCM通知,android,push-notification,Android,Push Notification,我正在尝试使用此链接将推送通知(FCM)发送到我的android应用程序。当应用程序处于后台时,一切正常,但一旦我杀死应用程序,我就不会收到任何声名。我使用android 7.1操作系统的Lenovo Tab。我还尝试将应用程序签名并作为APK安装。下面是我的gradle文件和logcat输出:- <activity android:name=".MainActivity" android:label="@string/app_name"

我正在尝试使用此链接将推送通知(FCM)发送到我的android应用程序。当应用程序处于后台时,一切正常,但一旦我杀死应用程序,我就不会收到任何声名。我使用android 7.1操作系统的Lenovo Tab。我还尝试将应用程序签名并作为APK安装。下面是我的gradle文件和logcat输出:-

        <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:windowSoftInputMode="adjustResize"
        android:exported="true">
        <intent-filter>
            <action android:name="android.intent.action.SEND" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="text/plain" />
        </intent-filter>
    </activity>
    <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />

    <meta-data  android:name="com.dieam.reactnativepushnotification.notification_channel_name"
        android:value="YOUR NOTIFICATION CHANNEL NAME"/>
    <meta-data  android:name="com.dieam.reactnativepushnotification.notification_channel_description"
        android:value="YOUR NOTIFICATION CHANNEL DESCRIPTION"/>
    <meta-data  android:name="com.dieam.reactnativepushnotification.notification_color"
        android:resource="@android:color/white"/>
    <receiver
        android:name="com.google.android.gms.gcm.GcmReceiver"
        android:exported="true"
        android:permission="com.google.android.c2dm.permission.SEND" >
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            <category android:name="com.liappmanager" />
        </intent-filter>
    </receiver>

    <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher" />
    <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver">
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
        </intent-filter>
    </receiver>
    <service android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationRegistrationService"/>
    <service
        android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerServiceGcm"
        android:exported="false" >
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
        </intent-filter>
    </service>
    <service
        android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService"
        android:exported="false" >
        <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT" />
        </intent-filter>
    </service>

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

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

</application>
03-02 12:00:15.673  1489  1536 W BroadcastQueue: Unable to launch app 
com.liappmanager/10279 for broadcast Intent { 
act=com.google.android.c2dm.intent.RECEIVE flg=0x10000010 
pkg=com.liappmanager (has extras) }: process is not granted
03-02 12:00:15.676  2369  2369 W GCM     : broadcast intent callback: 
result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE 
flg=0x10000000 pkg=com.liappmanager (has extras) }
正如您从logcat中看到的,我理解权限未被授予,但我在gradle文件中添加了权限。我是否仍然缺少有关权限的内容


[已解决]:如果您使用联想,请进入设置->电池优化->所有应用->{your APP}->不优化(检查),我最终解决了问题。这样(重新启动设备),将解决问题,供进一步参考检查

如果你已经解决了,就发布一个答案!