У меня есть следующий код для создания уведомления в строке состояния:
public void txtNotification(int id, String msg){
NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(android.R.drawable.sym_action_email, msg, System.currentTimeMillis());
// The PendingIntent will launch activity if the user selects this notification
Intent intent = new Intent(this, MainActivity.class)
intent.putExtra("yourpackage.notifyId", id);
PendingIntent contentIntent = PendingIntent.getActivity(this, 1, intent, 0);
notification.setLatestEventInfo(this, "title", msg, contentIntent);
manager.notify(id, notification);
}
При щелчке по уведомлению я хочу вызвать метод, желательно с доступом к идентификатору уведомление.
Заранее спасибо,
Тим
(РЕДАКТИРОВАТЬ: я обновил свой код после прочтения первого ответа, но все еще не делаю этого)