Notification bring activity to front

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

Notification bring activity to front

Postby mapiko » Sun Apr 03, 2011 10:25 am

Hello!

I'm finishing my app and have one last big problem. My activity starts service that updates UI through service connection. User can press home button and exits activity while service still running. If doing that a notification shows up. If user preses notification new activity starts and this is not good.
When user presses notification icon old activity should be brought to front.

Can anyone tell me how to do it?

Code for launching notification is here:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.                 nManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
  2.                
  3.                 Intent intent = new Intent(this,PlayAniAui.class);
  4.                 intent.putExtra("audiotrack", "");     
  5.                 Notification notification = new Notification(uk.tapmedia.relax.R.drawable.icon, "Relax in progress",
  6.                                 System.currentTimeMillis());
  7.        
  8.                 notification.setLatestEventInfo(getApplicationContext(), "Relaxing", "Application Relax now is runninng",
  9.                                 PendingIntent.getActivity(this.getBaseContext(), NOTIFY_ID, intent, PendingIntent.FLAG_CANCEL_CURRENT));
  10.  
  11.                 nManager.notify(NOTIFY_ID, notification);
  12.                         isProcessRunning = true;
  13.         }
Parsed in 0.034 seconds, using GeSHi 1.0.8.4


I've tried almost everything. And I can not get this thing working. But it worked before. And I have NO idea what I did
mapiko
Senior Developer
Senior Developer
 
Posts: 106
Joined: Sat May 15, 2010 5:19 pm

Top

Re: Notification bring activity to front

Postby strider2023 » Mon Apr 04, 2011 6:52 am

Check this thread...it might help...

http://stackoverflow.com/questions/4273 ... g-home-key
strider2023
Senior Developer
Senior Developer
 
Posts: 126
Joined: Tue Mar 02, 2010 6:34 am
Location: Chennai, India

Re: Notification bring activity to front

Postby mapiko » Mon Apr 04, 2011 7:05 am

Yes, did implement this. It works...
mapiko
Senior Developer
Senior Developer
 
Posts: 106
Joined: Sat May 15, 2010 5:19 pm

Re: Notification bring activity to front

Postby strider2023 » Mon Apr 04, 2011 7:07 am

Glad I could be of help..
strider2023
Senior Developer
Senior Developer
 
Posts: 126
Joined: Tue Mar 02, 2010 6:34 am
Location: Chennai, India

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 17 guests