change android notification message without stop and start service again
android
Solution
You are using the notification ID 7331 for showing a notification as well as starting the servie. As long as you are sending a new notification with the same ID, it will replace the old one.
Use this to update the notification
String ns = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager = (NotificationManager) context
.getSystemService(ns);
long when = System.currentTimeMillis();
Notification notification = new Notification("your icon", "your ticker text", when);
/*<set your intents here>*/
mNotificationManager.notify(7331, notification);
Problem
This is my method for `Notification` when I start `Service` on android: ``` private void showNotification() { Notification notification = new Notification(R.drawable.call, "Some text", System.currentTimeMillis()); Intent intent = new Intent(this, MainActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); PendingIntent pi = PendingIntent.getActivity(this, 0, intent, 0); notification.setLatestEventInfo(this, getString(R.string.notification_label), getString(R.string.notification_text_short), pi); notification.flags |= Notification.FLAG_NO_CLEAR; startForeground(7331, notification); } ``` is it possible to change text later. Now is for example `"Some text"` and later I would like to change it without stop and start service again. Is that possible?