[英]How to call another activity in android when notification received and app is in background
Tried all way but not getting output一路尝试但没有得到 output
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)
I solved this by sending (payload) data message instead of sending Notification.我通过发送(有效载荷)数据消息而不是发送通知来解决这个问题。
// 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"));
}
Reference link - https://stackoverflow.com/a/37845174/11201011参考链接 - https://stackoverflow.com/a/37845174/11201011
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.