小编Har*_*ish的帖子

oppo,vivo应用程序终止通知不在android fcm中出现

在Motorola中测试应用程序,当该应用程序被杀死时,三星可以正常工作。但是当我在体内测试应用程序时,oppo在应用程序被破坏的情况下无法正常工作。

 public void onMessageReceived(RemoteMessage remoteMessage) {
    Log.e(TAG, "From: " + remoteMessage.getFrom());

    if (remoteMessage == null)
        return;

    // Check if message contains a notification payload.
    if (remoteMessage.getNotification() != null) {
        Log.e(TAG, "Notification Body: " + remoteMessage.getNotification().getBody());
        //  handleNotification(remoteMessage.getNotification().getBody());
    }

    // Check if message contains a data payload.
    if (remoteMessage.getData().size() > 0) {
        Log.e(TAG, "Data Payload: " + remoteMessage.getData().toString());

        try {
            JSONObject json = new JSONObject(remoteMessage.getData().toString());
            handleDataMessage(json);
        } catch (Exception e) {
            Log.e(TAG, "Exception: " + e.getMessage());
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

Android清单xml:

 <service …
Run Code Online (Sandbox Code Playgroud)

android push-notification firebase firebase-cloud-messaging

3
推荐指数
1
解决办法
3705
查看次数