Consider the following onStartCommand() method of a foreground service
(music player):
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Intent main = new Intent(getApplicationContext(), Main.class);
PendingIntent pi =
PendingIntent.getActivity(getApplicationContext(), 0, main,
PendingIntent.FLAG_UPDATE_CURRENT);
Notification notification = new Notification();
notification.icon = R.drawable.status_bar_icon;
notification.tickerText = "text";
notification.flags |= Notification.FLAG_ONGOING_EVENT;
notification.setLatestEventInfo(getApplicationContext(), "text",
"text", pi);
startForeground(1, notification);
play();
return super.onStartCommand(intent, flags, startId);
}
Everything seems to be implemented according to the guides, but the
notification doesn't show up in the ongoing section of the notification
area, but only shortly as a notification in the status bar.
What could be wrong?
Thanks,
Andras
--
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