Hello fellow developers,
I have come across a problem, which has frustrated me for more than a
week. If I create a bar notification from activity, not from widget
the everything works fine. So in widget I can create notification only
once, but then I can't create another one or update the existing one.
Here is my procedure to create the notification bar:
public void notification(Context context, Intent intent)
{
//notification
String ns = context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager = (NotificationManager)
context.getSystemService(ns);
//notification options
int APP_ID = 1;
int icon = R.drawable.icon;
CharSequence tickerText = "Vārda Dienas";
long when = System.currentTimeMillis();
final Notification mynotification = new Notification(icon,
tickerText, when);
//show notification
CharSequence contentTitle = "Šodien vārda dienu svin:";
CharSequence contentText = VardaDienas_widget.now();
Intent notificationIntent = new Intent();
PendingIntent contentIntent = PendingIntent.getActivity(context,
0, notificationIntent, 0);
mynotification.setLatestEventInfo(context, contentTitle,
contentText, contentIntent);
mNotificationManager.notify(APP_ID, mynotification);
}
I call it like this notification(context, intent);
To sum up, I can only create a notification once, I can't update the
existing one and can't create another one.
Best Regards
Raivis Strogonovs
--
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