标签: oneplusx

fcm推送通知在一加6移动设备中不起作用

当设备处于后台,前景以及通过从托盘刷卡关闭某个应用程序时,FCM推送通知在以下设备中均能正常工作。品牌名称(android-Version)Micromax(5.1)摩托罗拉(7.1.1)诺基亚(8.1.0)三星(8.0.0)Nexus(8.1.0)小米(7.1.2)

但是在oneplus的情况下,当通过从托盘中刷卡关闭应用程序时,fcm通知不起作用,但是当应用程序处于前景和背景中时,fcm通知将正常工作。 设备版本OnePlus 8.1.0

但是,当我手动关闭应用程序的电池优化选项时,在所有情况下,fcm推送通知在Oneplus设备中均可正常工作

我的androidManifest.xml是

<?xml version="1.0" encoding="utf-8"?>
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.demo.Notification"
    android:installLocation="auto">

    <uses-permission android:name="android.permission.VIBRATE" />

    <application
        android:allowBackup="false"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme">

        <!-- [START fcm_default_icon] -->
        <!-- Set custom default icon. This is used when no icon is set for incoming notification messages. -->
        <meta-data
            android:name="com.google.firebase.messaging.default_notification_icon"
            android:resource="@mipmap/ic_launcher" />
        <!-- [END fcm_default_icon] -->
        <!-- [START fcm_default_channel] -->
        <meta-data
            android:name="com.google.firebase.messaging.default_notification_channel_id"
            android:value="@string/default_notification_channel_id"/>
        <!-- [END fcm_default_channel] -->

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

        <activity
            android:name="com.demo.Notification.MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity> …
Run Code Online (Sandbox Code Playgroud)

android battery push-notification oneplusx

6
推荐指数
1
解决办法
804
查看次数

标签 统计

android ×1

battery ×1

oneplusx ×1

push-notification ×1