title: Launch app from Notification Bar
body: <p>I am developing an android app using phonegap. I want to launch the app from the notification bar. Though this may be a duplicate question, but nothing seems to be working for me;few links that i have tried.</p>
  
  <p><a href="http://pilhuhn.blogspot.in/2010/12/pitfall-in-pendingintent-with-solution.html" rel="nofollow noreferrer">http://pilhuhn.blogspot.in/2010/12/pitfall-in-pendingintent-with-solution.html</a></p>
  
  <p><a href="https://stackoverflow.com/questions/10194718/open-android-app-from-push-notification">Open android app from PUSH notification</a></p>
  
  <p><a href="https://stackoverflow.com/questions/2960459/re-open-background-application-via-notification-item">re-open background application via notification item</a></p>
  
  <p>stand alone app developed from this links are working but when i integrate with my real project tapping on the notification bar does nothing, below is my code </p>
  
  <pre><code>NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
  
  Notification notification = new Notification(R.drawable.ic_launcher,"Message received", System.currentTimeMillis());
          notification.flags |= Notification.FLAG_ONLY_ALERT_ONCE | Notification.FLAG_AUTO_CANCEL;
  
  Intent intent = new Intent(context, MyClass.class);
  
  intent.putExtra("message", message);
  intent.putExtra("shortMsg", shortMsg);
  intent.putExtra("source", source);
  intent.putExtra("phone", phone);
  intent.putExtra("datetime", datetime);
  intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  
  context.startActivity(intent);
  
  PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
          notification.setLatestEventInfo(context, "Message", "New message received", pendingIntent);
  
  notificationManager.notify(0, notification);
  </code></pre>
  
  <p>MyClass.class Code,</p>
  
  <pre><code>Bundle extras = getIntent().getExtras();
  if (extras != null) 
  {
      System.out.println("in extras");            
      //Retrive data from the intent and store them in instance variables
      this.message = extras.getString("message");
      this.shortMsg = extras.getString("shortMsg");
      this.source = extras.getString("source");
      this.phone = extras.getString("phone");
      this.datetime = extras.getString("datetime");
  }
  </code></pre>
  
  <p>Thanks in Advance,</p>
  
  <p>Nanashi</p>