1
当我得到一个新的任务时会弹出一个通知。点击该通知后,它会转到TestExList.java活动。Android通知点击
private void createNewTaskNotification(String s, String id) {
CharSequence title = "TASK";
CharSequence message = s;
notificationManager = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(R.drawable.checkyes, s,
System.currentTimeMillis());
notification.flags = Notification.FLAG_AUTO_CANCEL;
notification.defaults |= Notification.DEFAULT_SOUND;
notification.defaults |= Notification.DEFAULT_VIBRATE;
Intent notificationIntent = new Intent(context, TestExList.class);
notificationIntent.putExtra("EmpID", Functions.getLoginEmpID(context));
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(context,
Integer.parseInt(id), notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
notification.setLatestEventInfo(context, title, message, pendingIntent);
notificationManager.notify(Integer.parseInt(id), notification);
}
它的工作方式是,如果我在另一个屏幕上,单击通知将我带到TestExList.java。
如果我在同一个屏幕上(TestExList.java),它不会加载该页面。我想刷新该页面,以便我可以在该页面上看到我的新任务。
我做错了什么?
这实际上帮助我解决了我的通知来自Google推送服务的问题。欢呼 – wired00 2013-05-03 04:04:57