Android Oreo后台未调用FCM通知

Android Oreo后台未调用FCM通知,android,firebase,firebase-cloud-messaging,android-8.0-oreo,Android,Firebase,Firebase Cloud Messaging,Android 8.0 Oreo,当用户未连接到xmpp时,我使用FCM通知进行聊天 FCM中有两种通知模式 1.通知消息 2.数据信息 如果我的应用程序已从最近的应用程序中清除,则我不会使用数据消息作为通知消息 这种方法适用于除Oreo之外的所有版本 对于Oreo,我只在应用程序未连接到xmpp且处于前台时收到通知。我的onMessageReceived方法正在被调用 但当该应用程序仅为Oreo而被删除或删除时,情况就不一样了 编辑:我试过一加三的设备 感谢您的帮助。Oreo引入了通知渠道的概念。检查 启动时创建频道: if

当用户未连接到xmpp时,我使用FCM通知进行聊天

FCM中有两种通知模式 1.通知消息 2.数据信息

如果我的应用程序已从最近的应用程序中清除,则我不会使用数据消息作为通知消息

这种方法适用于除Oreo之外的所有版本

对于Oreo,我只在应用程序未连接到xmpp且处于前台时收到通知。我的onMessageReceived方法正在被调用

但当该应用程序仅为Oreo而被删除或删除时,情况就不一样了

编辑:我试过一加三的设备


感谢您的帮助。

Oreo引入了通知渠道的概念。检查

启动时创建频道:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
    // Create the NotificationChannel
    CharSequence name = getString(R.string.channel_name);
    String description = getString(R.string.channel_description);
    int importance = NotificationManager.IMPORTANCE_DEFAULT;
    NotificationChannel mChannel = new NotificationChannel(CHANNEL_ID, name, importance);
    mChannel.setDescription(description);
    // Register the channel with the system; you can't change the importance
    // or other notification behaviors after this
    NotificationManager notificationManager = (NotificationManager) getSystemService(
            NOTIFICATION_SERVICE);
    notificationManager.createNotificationChannel(mChannel);
}
在清单中设置ID:

<meta-data
        android:name="com.google.firebase.messaging.default_notification_channel_id"
        android:value="@string/notification_channel_id"/>


notification\u channel\u id
与Oreo中的变量
channel\u id
相同。引入了通知通道的概念。检查

启动时创建频道:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
    // Create the NotificationChannel
    CharSequence name = getString(R.string.channel_name);
    String description = getString(R.string.channel_description);
    int importance = NotificationManager.IMPORTANCE_DEFAULT;
    NotificationChannel mChannel = new NotificationChannel(CHANNEL_ID, name, importance);
    mChannel.setDescription(description);
    // Register the channel with the system; you can't change the importance
    // or other notification behaviors after this
    NotificationManager notificationManager = (NotificationManager) getSystemService(
            NOTIFICATION_SERVICE);
    notificationManager.createNotificationChannel(mChannel);
}
在清单中设置ID:

<meta-data
        android:name="com.google.firebase.messaging.default_notification_channel_id"
        android:value="@string/notification_channel_id"/>


notification\u channel\u id
与变量
channel\u id
这可能太晚了,无法回答,但One Plus手机有一个称为电池优化的功能。一旦关闭应用程序的电池优化功能,您将开始接收后台通知。我的One Plus 5T也有同样的问题。

现在回答这个问题可能太晚了,但是One Plus手机有一个叫做电池优化的功能。一旦关闭应用程序的电池优化功能,您将开始接收后台通知。我的One Plus 5T也有同样的问题。

它是什么类型的设备?某些手机具有后台终止功能,该功能禁用了在后台接收消息的功能。在one plus 3上试用过您是否使用发送消息?您是否成功完成了此操作?在三星设备上未收到通知。您是否设法使所有设备都能使用此功能?它是什么类型的设备?某些手机具有后台终止功能,该功能禁用了在后台接收消息的功能。在one plus 3上试用过您是否使用发送消息?您是否成功完成了此操作?在三星设备上未收到通知。您是否成功地使所有设备都能使用此功能?@Siddhant非常感谢。。你有没有找到任何程序上的修正?除了手动禁用外:/@Victor我认为这个问题不能通过编程解决,因为它是OEM特有的问题(@Siddhant非常感谢..你找到任何程序性的修复方法了吗?除了手动禁用之外:/@Victor我认为这个问题不能通过编程方式解决,因为它是OEM特有的问题:(