Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/212.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中的其他活动_Android_Kotlin_Notifications_Firebase Cloud Messaging - Fatal编程技术网

当收到通知且应用程序位于后台时,如何调用android中的其他活动

当收到通知且应用程序位于后台时,如何调用android中的其他活动,android,kotlin,notifications,firebase-cloud-messaging,Android,Kotlin,Notifications,Firebase Cloud Messaging,尝试了所有的方法,但没有得到输出 var intent = Intent(application, NavigationDrawerActivity::class.java) intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK) startActivity(intent) 我通过发送(有效负载)数据消息而不是发送

尝试了所有的方法,但没有得到输出

 var intent = Intent(application, NavigationDrawerActivity::class.java)
 intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK)
 startActivity(intent)
我通过发送(有效负载)数据消息而不是发送通知来解决这个问题

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

  sendNotification(remoteMessage.getData().get("message"));
 } 

应使用PendingEvent打开通知中的活动,请参阅此感谢回答@MuthukrishnanRajendran