-
Anonymous
Как я могу обновить существующие уведомления в Android?
Сообщение
Anonymous »
Я использую следующий код для отображения уведомления. После отображения уведомления я перехожу к действию, если нажимаю на уведомления.
Код: Выделить всё
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);
}
Теперь я хочу обновить текст уведомлений. Как я могу это сделать?
Подробнее здесь:
https://stackoverflow.com/questions/325 ... in-android
1761256579
Anonymous
Я использую следующий код для отображения уведомления. После отображения уведомления я перехожу к действию, если нажимаю на уведомления.
[code]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);
}
[/code]
Теперь я хочу обновить текст уведомлений. Как я могу это сделать?
Подробнее здесь: [url]https://stackoverflow.com/questions/32561549/how-can-i-update-existing-notifications-in-android[/url]