So here's the setup... I have an application that streams a live radio station from a URL. I currently have it so that the stream still resumes playing after the user has pressed the back button. As of current, the only way to get back into the application is to press and hold the home button then select the app. I would like it so that the application can be accessed more easily by placing it in the notification panel. I am able to achieve this setup, however, the notification panel insists on creating a new activity. This overwrites the previous activity making it impossible to stop the stream or quite the application (without having to force close). I am looking for a way to get the application into the notification panel, and when pressed, bring back the EXACT state, so that the stream and application can be manipulated as if it has never been exited. Here is what I have for the showNotification method...
private void showNotification() { CharSequence text = "My Positive Edge"; Context context = getApplicationContext(); NotificationManager mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); notificationIntent = new Intent(context, NewMPEStreamImpl.class); Notification notification = new Notification(R.drawable.klrc_icon, text, System.currentTimeMillis()); PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, Intent.FLAG_ACTIVITY_SINGLE_TOP); notification.setLatestEventInfo(context, "My Positive Edge",this.isPlaying, contentIntent); notification.flags = Notification.FLAG_ONGOING_EVENT | Notification.FLAG_NO_CLEAR; notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); mNotificationManager.notify(1, notification); }
Is this the service I should be calling for what I'm wanting to do, or do I need something completely different?