【发布时间】:2014-12-18 11:06:38
【问题描述】:
在我的应用程序中,当完成异步文件中的任务时,它会显示带有此代码的通知
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
PendingIntent pIntent = PendingIntent.getActivity(context.getApplicationContext(), 0, new Intent(), 0);
Notification noti = new Notification.Builder(context)
.setContentTitle("Complete")
.setSmallIcon(R.drawable.ic_launcher)
.setContentIntent(pIntent)
.setAutoCancel(true)
.build();
notificationManager.notify(0, noti);
问题是当我点击通知时,什么也没有发生。基本上我想要这样,如果应用程序已经打开并且用户单击通知,那么什么都不应该打开。如果应用程序未打开(这意味着它仍在运行但已最小化),那么我希望它打开应用程序,例如最大化它。
有人知道怎么做吗?
谢谢
【问题讨论】:
标签: android notifications push-notification