Click on notification message

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

Click on notification message

Postby K20 » Wed Jul 22, 2009 8:10 pm

Hi,

I have a problem with the notification system ...
In my application i have an Intent which display an elasted time since the user push a button.

When user push the button it display an notification which is create with this code :
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. PendingIntent contentIntent = PendingIntent.getActivity(this, Ride.GET_RIDE, this.getIntent(), PendingIntent.FLAG_NO_CREATE);
  2.  
  3.        
  4.  
  5.             Notification notification = new Notification(statusBarIconID, "Ride, lancement d'un trajet", System.currentTimeMillis());
  6.  
  7.             notification.flags |= Notification.FLAG_NO_CLEAR;
  8.  
  9.             notification.flags |= Notification.FLAG_ONGOING_EVENT;
  10.  
  11.             notification.setLatestEventInfo(getApplicationContext(), statusBarText, detailedText, contentIntent);
  12.  
  13.            
  14.  
  15.             mNotificationManager.notify(NOTIFICATION_ID, notification);
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


My goal is that when the user click in the notification message it display the actual intent !
But with this code it launch a new Intent and not my actual activity :(

What is wrong with my method ?

Thanks in advance for your anwsers !
K20
Freshman
Freshman
 
Posts: 5
Joined: Wed Jul 22, 2009 8:03 pm

Top

Postby K20 » Thu Jul 30, 2009 8:30 pm

Anyone have the solution ? :(
K20
Freshman
Freshman
 
Posts: 5
Joined: Wed Jul 22, 2009 8:03 pm

Postby K20 » Mon Aug 10, 2009 3:44 pm

Anyone ?
K20
Freshman
Freshman
 
Posts: 5
Joined: Wed Jul 22, 2009 8:03 pm

Re: Click on notification message

Postby rqg0717 » Wed Jun 30, 2010 8:20 pm

I hope the following code can help you out.
Code: Select all
        Intent intent = this.getIntent();
        intent.setFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY); //
        // The PendingIntent to launch our activity if the user selects this notification
        PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
              intent, 0);
rqg0717
Once Poster
Once Poster
 
Posts: 1
Joined: Tue Mar 30, 2010 6:30 pm
Location: Philly

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Exabot [Bot] and 18 guests