Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/181.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 未调用接收到的Onesignal远程通知方法_Android_Android Studio_Kotlin_Onesignal - Fatal编程技术网

Android 未调用接收到的Onesignal远程通知方法

Android 未调用接收到的Onesignal远程通知方法,android,android-studio,kotlin,onesignal,Android,Android Studio,Kotlin,Onesignal,我想在我的数据库中保存通知,所以我从这里开始遵循文档的两个步骤 但根本不调用remoteNotificationReceived方法。 我使用了SetNotificationWillShowInformeGroundHandler,如下所示,它可以工作,但我希望即使应用程序在后台也能收到通知 OneSignal.setNotificationWillShowInForegroundHandler(notificationReceivedEvent -> { // not c

我想在我的数据库中保存通知,所以我从这里开始遵循文档的两个步骤 但根本不调用remoteNotificationReceived方法。 我使用了SetNotificationWillShowInformeGroundHandler,如下所示,它可以工作,但我希望即使应用程序在后台也能收到通知

OneSignal.setNotificationWillShowInForegroundHandler(notificationReceivedEvent -> {
        // not called while in background
});

我还应该提到推送通知工作正常,我在设备上收到通知

您需要为后台通知处理添加实现

查看下面的文档链接

  • 一般处理:

  • 后台通知处理:


我正在使用NotificationExtender服务,它工作得很好。

我通过在一个空的单独类中实现OSRemoteNotificationReceivedHandler来解决这个问题。

谢谢你的回答,但我已经解决了