Football Fans: Download the 2012 Schedule App from Google Play!


Go Back   Android Forums > Android Development > Application Development

Application Development Dev Lounge for the Coder Folks



Reply
 
LinkBack Thread Tools
Old November 22nd, 2011, 05:31 PM   #1 (permalink)
New Member
 
Join Date: Nov 2011
Posts: 1
 
Device(s):
Thanks: 0
Thanked 0 Times in 0 Posts
Default Resume Application in Original State

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...

Code:
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?

WhiteSoup12 is offline  
Reply With Quote
Sponsors
Reply

Bookmarks


Go Back   Android Forums > Android Development > Application Development User CP
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -5. The time now is 11:49 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Custom vBulletin Skins by: Relivo