Как установить прослушиватель щелчков для уведомления?

Я использую следующий код для запуска уведомления при запуске службы через AlarmManager:

nm = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
CharSequence from = "App";
CharSequence message = "Getting Latest Info...";
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(), 0);
Notification notif = new Notification(R.drawable.icon,
    "Getting Latest Info...", System.currentTimeMillis());
notif.setLatestEventInfo(this, from, message, contentIntent);
nm.notify(1, notif);

Как мне установить намерение для этого элемента, чтобы, когда пользователь нажимает на него, он запустит определенное действие?

23
задан Ziem 2 May 2015 в 12:18
поделиться