Android: Part of my extras are getting lost in pending intent
<p>I am making an Android app for the first time and I am having this problem.
When a user A sends a friend request to another user B, user B gets a notification. I wish when the user B click on the notification to be redirected to user A profile. </p>

<p>The main activity (Home in app) opens different fragments depending on from where the user is coming. A user profile is one such fragment. </p>

<p>This is how I am sending the notification from a presenter class for Main Activity.</p>

<pre><code>Intent notificationIntent = new Intent(activity.getApplicationContext(), MainActivity.class);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);

Bundle extras = new Bundle();
extras.putString("name" ,this.friendRequestFromUserName.toString());
extras.putString("email", this.friendRequestFromUserEmail);
extras.putString("notification", "notificationFriendRequest");

notificationIntent.putExtras(extras);

System.out.println("PUTTING EXTRA");
System.out.println(notificationIntent.getExtras().toString());
// output here is:
//Bundle[{name=The Lion King, email=mufasa@lionking.com, notification=notificationFriendRequest}]

NotificationCompat.Builder builder = new NotificationCompat.Builder(activity)
    .setSmallIcon(R.drawable.ic_notification)
    .setContentTitle("New friend!")
    .setContentText(this.friendRequestFromUserName + " wants to be friends.")
    .setAutoCancel(true)
    .setOnlyAlertOnce(true)
    .setOngoing(false)
    .setContentIntent(PendingIntent.getActivity(activity.getApplicationContext(), 0, notificationIntent, 0));

builder.setOngoing(false);
builder.setAutoCancel(true);

Notification not = builder.build();
not.flags = Notification.FLAG_AUTO_CANCEL;
NotificationManager manager = (NotificationManager)this.activity.getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);
        manager.notify(123, not);
</code></pre>

<p>However in the main activity when user clicks on the notification only part of the Bundle is "arriving".
Here are the ways I tried to get the extras:</p>

<pre><code>    extraName = intent.getStringExtra("name");
    extraMail = intent.getStringExtra("email");
    extra = intent.getStringExtra("notification");
</code></pre>

<p>and</p>

<pre><code>    System.out.println(intent.getExtras().toString());
    //Bundle[{notification=notificationFriendRequest}]
</code></pre>

<p>I also tried putting arrays as extra with the same result. Since part of my extra is arriving, but other is not, and I couldn't find similar topic and problem I decided to ask if somebody can help or explain why or how this can happen. Thanks. </p>