0
A
回答
0
请参阅下面的代码。我正在使用它,它正在打开我的HomeActivity。
NotificationManager notificationManager = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(icon, message, when);
Intent notificationIntent = new Intent(context, HomeActivity.class);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
| Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent intent = PendingIntent.getActivity(context, 0,
notificationIntent, 0);
notification.setLatestEventInfo(context, title, message, intent);
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(0, notification);
相关问题
- 1. 如何重新打开点击/点击通知的活动
- 2. 当通知的点击,打开活动
- 3. 无法打开通知点击活动
- 4. 点击通知没有打开活动
- 5. 如何重新打开通知中的活动点击我android
- 6. 如何在点击推送通知时打开新的活动?
- 7. Android通知PendingIntent每通知点击打开活动
- 8. 打开通知活动时点击通知与firebase
- 9. 如何知道点击通知后是否打开了活动?
- 10. 打开新的活动OnImageButton点击
- 11. 执行点击新打开的活动
- 12. 点击通知开始活动两次
- 13. 点击通知没有打开提到的活动
- 14. 根据通知操作点击打开不同的活动
- 15. 当点击通知时更新活动
- 16. 打开特定活动时通知在后台点击
- 17. 在FCM中点击通知时打开特定活动
- 18. 如何在点击通知后打开特定活动?
- 19. 如何在点击差异通知后打开同一活动
- 20. 在FCM通知点击Android后打开活动
- 21. 点击推送通知后打开活动
- 22. 如果点击通知,如何打开anoter活动?
- 23. 如何打开通知组非发射活动点击
- 24. 我怎样才能打开活动时通知点击
- 25. Android - 为什么活动在点击通知后打开?
- 26. 打开活动已从通知打开
- 27. 单击通知后未打开新活动Android
- 28. 如果在点击通知时已打开,请勿打开活动
- 29. Android的 - 活动的通知点击重新启动(该通知已被打开前台服务)
- 30. 通知图标点击开始新活动
感谢您的帮助,顺便说一句,在哪里把该代码..?实际上,我使用Android工作室 – Ksr
创建了多个PendingIntent对象,其Intents只在其“额外”内容中有所不同,期望每次都获得不同的PendingIntent。 –
否则可以发布代码 –