I'm creating a notification from a service to notify the main activity
that a job is done.
The problem is when the user taps on the notification, it seems to
create a new instance of the activity.
If i press BACK back, there's now 2.
Is a way to instruction the notification object, to notify the
existing
activity.
here's my code straight from the SDK reference.
int icon = R.drawable.wx2; // icon from resources
CharSequence tickerText = "Hello"; // ticker-text
long when = System.currentTimeMillis(); // notification
time
Context context = getApplicationContext(); // application
Context
CharSequence contentTitle = "My notification"; // expanded
message
title
CharSequence contentText = "Hello World!"; // expanded
message
text
Intent notificationIntent = new Intent(this,
StartupActivity.class); // << my main activity
PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
notificationIntent, 0);
// the next two lines initialize the Notification, using the
configurations above
Notification notification = new Notification(icon, tickerText,
when);
notification.setLatestEventInfo(context, contentTitle,
contentText,
contentIntent);
NotificationManager mNotificationManager = (NotificationManager)
getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(1, notification);
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en