2
通過我的通知系統,發送通知時,我希望能夠點擊通知並將其發送給我的應用程序。但是,用我目前的代碼,它並沒有這樣做。我該如何解決這個問題?點擊通知 - 發送到應用程序
public void causeNotification(CharSequence contentText, CharSequence tickerText) {
Log.d(TAG, "Sending notification - \"" + contentText + "\"");
String ns = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);
int icon = R.drawable.neoseeker_swoosh;
long when = System.currentTimeMillis();
Notification notification = new Notification(icon, tickerText, when);
notification.defaults |= Notification.DEFAULT_ALL;
notification.defaults |= Notification.FLAG_AUTO_CANCEL;
Context context = getApplicationContext();
CharSequence contentTitle = "Neoseeker";
Intent notificationIntent = new Intent();
PendingIntent contentIntent = PendingIntent.getActivity(Neoseeker.this, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
mNotificationManager.notify(Neoseeker.NOTIFICATION_ID, notification);
}
工作就像它,謝謝隊友! – Chiggins 2010-07-04 16:47:43