Notification for an ongoing service

Put your problem here if it does not fit any of the other categories.

Notification for an ongoing service

Postby michael1221988 » Sun Mar 21, 2010 11:20 pm

I have a notification set up when a service is running (playing some music). However when I click the notification it creates a new activity instead of using the one that is already running in the background. How can I get it to just bring up the original activity that started the service? here is what I have now
Code: Select all
         Intent notifyIntent = new Intent(this, MediaPlayback.class);
         PendingIntent intent = PendingIntent.getActivity(this, 0,
               notifyIntent, android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
         Notification notifyDetails = new Notification(
               R.drawable.stat_notify_musicplayer, Contents.getSong().name,
         notifyDetails.flags = Notification.FLAG_FOREGROUND_SERVICE
               | Notification.FLAG_ONGOING_EVENT;
         notifyDetails.setLatestEventInfo(context, contentTitle, contentText,
         mNotificationManager.notify(1, notifyDetails);
Junior Developer
Junior Developer
Posts: 12
Joined: Fri Jan 08, 2010 4:39 am


Return to Other Coding-Problems

Who is online

Users browsing this forum: MSNbot Media and 14 guests