Я использую следующий код для отображения уведомления. После отображения уведомления я перейду к активности, если я нажму на уведомления.Как обновить существующие уведомления в Android?
void Notify(String notificationTitle, String notificationMessage){
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(R.drawable.noti, notificationTitle,System.currentTimeMillis());
Intent notificationIntent = new Intent(this, SmsActivity.class);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
| Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent intent = PendingIntent.getActivity(this, 0,
notificationIntent, 0);
notification.setLatestEventInfo(this, notificationTitle,notificationMessage, intent);
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(0, notification);
}
Теперь я хочу обновить текст уведомлений. Как я могу это сделать ?
Я думаю, вам следует опубликовать другое уведомление с тем же идентификатором, после чего оно будет обновлено – Emil