title: I want to start a pendingIntent when user click on a notification sent from one app to the other
body: <p>I want to start a pendingIntent from a notification i send from App A = Admin to App B = users. I want to know if it possible to open a pendingIntent immediately a user or admin receives a notification(from each end)?</p>
  
  <p>My App crashes when i try to open a notification sent from admin to user app and vice versa but I am using the same method below in both apps. What am i doing wrong?</p>
  
  <p>NB :  it is just a chat and suggestion app and it works like any other chat application.</p>
  
  <pre><code>    // sending notification to devices with versions below Oreo(android 8.0)
      private void sendNotification(RemoteMessage remoteMessage) {
  
          String user  = remoteMessage.getData().get("user");
          String icon = remoteMessage.getData().get("icon");
          String title = remoteMessage.getData().get("title");
          String body = remoteMessage.getData().get("body");
  
          RemoteMessage.Notification notification = remoteMessage.getNotification();
          // creating a pendingIntent for notification
          int j = Integer.parseInt(user.replaceAll("[\\D]",""));
          Intent intent = new Intent(this,MessageActivity.class);
          Bundle bundle = new Bundle();
          bundle.putString("userid",user);
          intent.putExtras(bundle);
          intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
          PendingIntent pendingIntent = PendingIntent.getActivity(this,j,intent,PendingIntent.FLAG_ONE_SHOT);
  
          //  notification sound uri
          Uri defaultSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
          // creating an instance of Notification builder and setting its properties
          NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
                  .setSmallIcon(R.mipmap.app_logo_round)
                  .setContentTitle(title)
                  .setContentText(body)
                  .setAutoCancel(false)
                  .setSound(defaultSound)
                  .setVibrate(new long[]{1000,1000,1000})
                  .setWhen(System.currentTimeMillis());
                  .setContentIntent(pendingIntent);
  
   // creating an instance of Notification Manager
          NotificationManager nm = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
  
          int i = 0;
          if(j &gt; 0){
              i = j;
          }
  
          // starting the notification
          nm.notify(i,builder.build());
  
   }
  </code></pre>
  
  <p>What I want to achieve is to be able to open app from notification if an admin sends a message which comes with a notification to the user and vice versa.</p>