允许自动启动后,FCM通知在oppo(彩色操作系统)中不起作用

时间:2019-02-27 09:16:00

标签: android push-notification firebase-cloud-messaging

我在Android应用程序中使用FCM。当应用程序在后台运行但从后台终止后,通知运行正常。

我的手机是 oppo f9 pro

我手动启用了自动启动功能,并在后台启用了允许。

enter image description here

在后台启用

enter image description here

我的Firebase服务

public class MyFirebaseMessagingService extends FirebaseMessagingService {

private static final String TAG = "myFirebaseMsgService";

@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
    super.onMessageReceived(remoteMessage);

    Log.d(TAG, "From : " + remoteMessage.getFrom());

    if (remoteMessage.getData().size() > 0) {
        Log.d(TAG, "Message Data : " + remoteMessage.getData());
    }

    if (remoteMessage.getNotification() != null) {
    }

}
}

发送有效载荷

{
"notification":{"title":"testing of notification - new ","body":"body of notification ","sound":"Enabled"

},
"data":{
    "id":74,
    "callFrom":"test",
    "other_info":"other detail in other info"
},
"to":"c5V-l4poMYI:APA91bFk8DO6upFN9dSXjI3d9UXpRUvmdzPo9OyUV9LnLJhCA6vBQ4y6TuXWHg1vaGM0SV6bEOLDW38UFEsVhcHFRvT7oIkGNmtd2v6516ABh6MyvkuoFP7gwUJWOPQRCaPsVg8_O2ot"
}

0 个答案:

没有答案