title: Why PendingIntent opens the launcher activity of the app rather than specific activity?
body: <p>I am using firebase to send notification. It will open ResultActivity when user click on notification. It is working fine when app is in foreground. But when app is in background, it open the HomeActivity (which is the launcher activity of the app) rather than ResultActivity. I can't understand whats the problem?</p>
  
  <pre><code>public class MyFirebaseMessagingService extends FirebaseMessagingService {
  
      @Override
      public void onMessageReceived(RemoteMessage remoteMessage) {
          NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this);
          notificationBuilder.setContentTitle(getResources().getString(R.string.app_name));
          notificationBuilder.setContentText(remoteMessage.getNotification().getBody());
          notificationBuilder.setAutoCancel(true);
          notificationBuilder.setSmallIcon(R.mipmap.ic_launcher);
  
          Intent intent = new Intent(getApplicationContext(), ResultActivity.class);
  
          PendingIntent pendingIntent = PendingIntent.getActivity(getApplicationContext(), 0, intent, PendingIntent.FLAG_ONE_SHOT);
  
          notificationBuilder.setContentIntent(pendingIntent);
          NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
          notificationManager.notify(0, notificationBuilder.build());
      }
  }
  </code></pre>