Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.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 FirebaseMessagingService类中不存在handleIntent方法_Android_Firebase_Firebase Cloud Messaging - Fatal编程技术网

Android FirebaseMessagingService类中不存在handleIntent方法

Android FirebaseMessagingService类中不存在handleIntent方法,android,firebase,firebase-cloud-messaging,Android,Firebase,Firebase Cloud Messaging,我正在使用Firebase消息服务v 17.3.0,我想在应用程序处于后台时在logcat中获取数据消息。正如我所看到的,在早期版本中,有一个名为handleIntent的方法来获取消息,无论应用程序是在后台还是前台 在较新版本中,处理显示消息和数据消息的替代方法是什么,因为onMessageReceived(RemoteMessage RemoteMessage)方法仅在应用程序位于前台时有效 我不想降级到早期版本。如果您使用数据有效负载,那么当应用程序位于前台或后台时,可以调用onMessa

我正在使用Firebase消息服务v 17.3.0,我想在应用程序处于后台时在logcat中获取数据消息。正如我所看到的,在早期版本中,有一个名为handleIntent的方法来获取消息,无论应用程序是在后台还是前台

在较新版本中,处理显示消息和数据消息的替代方法是什么,因为onMessageReceived(RemoteMessage RemoteMessage)方法仅在应用程序位于前台时有效


我不想降级到早期版本。

如果您使用数据有效负载,那么当应用程序位于前台或后台时,可以调用
onMessageReceived

因此,在云计算功能中,您可以使用以下功能:

 const payload = {
 data: {
    title:"notification",
    body: "hello world",
    sound: "default"
    },
 };
选中此项: