У меня есть следующий код для создания сообщения в строке состояния:
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);
}
При нажатии на уведомление, я хочу вызвать метод, желательно с доступом к идентификатору уведомления.
Спасибо заранее,
Тим
(EDIT: я обновил свой код после прочтения первого ответа, но я до сих пор не знаю, как слушать намерение)