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