【发布时间】:2013-11-12 04:08:56
【问题描述】:
我已经尝试过通知示例。
我可以在通知点击事件上打开活动。
是否可以在通知点击事件中打开所需的标签小部件。
任何机构帮助我在通知点击事件上打开标签主机。
请检查下面的代码..
int icon = R.drawable.ic_launcher;
long when = System.currentTimeMillis();
NotificationManager notificationManager = (NotificationManager)
context.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(icon, message, when);
String title = context.getString(R.string.app_name);
notification.defaults |= Notification.DEFAULT_SOUND;
notification.defaults |= Notification.DEFAULT_VIBRATE;
Intent notificationIntent = new Intent(context, Viewmessage.class);
notificationIntent.putExtra("NotificationMessage",message);
notificationIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingNotificationIntent = PendingIntent.getActivity(context,0,notificationIntent,PendingIntent.FLAG_UPDATE_CURRENT);
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notification.setLatestEventInfo(context, title, message, pendingNotificationIntent);
notificationManager.notify(0, notification);
【问题讨论】: