0

当我的应用程序在后台运行时,我可以使用 NotificationManager 显示通知。当应用程序在前台运行时,如果用户尝试打开状态栏中的通知,我需要阻止活动打开过程。因为当前正在运行的活动受到影响。所以我不想打开新活动...提前谢谢..

4

3 回答 3

0

您可以使用以下代码使用通知导航到任何活动

Intent notifyIntent;
notifyIntent = new Intent(activityA.this,activityB.class);
PendingIntent intent =PendingIntent.getActivity(punchclock.this, 0,notifyIntent, android.content.Intent.FLAG_ACTIVITY_NEW_TASK);

祝你好运

于 2012-07-16T10:13:46.660 回答
0

我已经在此给定链接上提供了与通知相关的详细信息.. 可能会对您有所帮助..如何通过单击通知来执行方法

于 2012-07-16T10:14:44.100 回答
0

当您调用 mNotificationManager.notify(HELLO_ID, notification); 在您显示通知传递的服务/活动中 Intent notificationIntent = new Intent(this); 如果您的活动已打开,则符合您的待定意图。否则通过 Intent 让活动打开它。

于 2012-07-16T10:15:21.090 回答