title: How to open particular fragment on the click of the push notification message?
body: <p>I want to open the particular fragment on the click of the push notification message.In my case fragment is open when the notification occurs.but i want to open the fragment on the click of the notification message instead of arriving the message.</p>
  
  <p>This is my sendNotification() method :-</p>
  
  <pre><code> private void sendNotification(String msg) {
  
          mNotificationManager = (NotificationManager) this
                  .getSystemService(Context.NOTIFICATION_SERVICE);
  
  
          Intent intent = new Intent(this, MainActivity.class);
           intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
          intent.putExtra("data", "fromoutside");
          getApplicationContext().startActivity(intent);
  
          PendingIntent contentIntent = PendingIntent.getActivity(this, 0, intent, 0);
  
  
          NotificationCompat.Builder mBuilder = (NotificationCompat.Builder) new NotificationCompat.Builder(this)
                  .setSmallIcon(getNotificationIcon())
                  .setContentTitle("Telepoh")
                  .setStyle(new NotificationCompat.BigTextStyle().bigText(msg))
                  .setContentText(msg)
                  .setDefaults(Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE);
  
          mBuilder.setContentIntent(contentIntent);
          mBuilder.getNotification().flags |= Notification.FLAG_AUTO_CANCEL;
          mBuilder.setAutoCancel(true);
  
  
          mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
      } 
  </code></pre>
  
  <p>This is my onNewIntent() method which override in the MainActivity where i open the fragment :-</p>
  
  <pre><code>@Override
      protected void onNewIntent(Intent intent) {
          super.onNewIntent(intent);
          Fragment fragment = new NotificationActivity();
          getSupportFragmentManager().beginTransaction().replace(R.id.container, fragment).addToBackStack(null).commit();
  
      }
  </code></pre>
  
  <p>My Problem is I want to open this fragment on the click of the push notification message but in my case the fragment is open when the push notification message is arrive.</p>