I got the notification working! For anyone else who is having a
similar problem, I have pasted the code below. For me, it is in the
onCreate method of a service class.
public void onCreate()
{
Intent launchIntent = new Intent(this, ActivityListView.class);
CharSequence tickerText = getText(R.string.app_name);
CharSequence descriptionText = getText
(R.string.notifier_description);
PendingIntent contentIntent =
PendingIntent.getActivity(this, 0, launchIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
Notification notifier = new Notification
(R.drawable.alt_launcher_icon, tickerText, System.currentTimeMillis
());
notifier.setLatestEventInfo(getBaseContext(), tickerText,
descriptionText, contentIntent);
notifier.contentView = new RemoteViews("com.magouyaware.multitasker",
R.layout.notifier);
notifier.flags = Notification.FLAG_NO_CLEAR |
Notification.FLAG_ONGOING_EVENT |
Notification.DEFAULT_LIGHTS |
Notification.DEFAULT_SOUND |
Notification.DEFAULT_VIBRATE;
NotificationManager mgr = (NotificationManager)getSystemService
(NOTIFICATION_SERVICE);
mgr.notify(R.string.app_notifier_id, notifier);
stopSelf();
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---