title: How to properly receive Intent Extras on xamarin
body: <p>At the moment I'm using <a href="https://docs.microsoft.com/en-us/xamarin/android/data-cloud/google-messaging/remote-notifications-with-fcm?tabs=windows" rel="nofollow noreferrer">this</a> tutorial for xamarin push notifications. It's working like a charm. My goal now is to handle the intents properly. </p>
  
  <p>In my firebase messaging service, I create a notification and Put extras. </p>
  
  <pre><code>private void CreateNotification(Object e)
  {
      try
      {
          string title = "";
          string body = "";
  
          var intent = new Intent(this, typeof(MainActivity));
  
          var i = e as Intent;
          var bundle = i.Extras;
          title = bundle.GetString("gcm.notification.title");
          body = bundle.GetString("gcm.notification.body");
  
          intent.PutExtra("view", "test");
          intent.PutExtra("title", title);
          intent.PutExtra("body", body);
  
          intent.AddFlags(ActivityFlags.ClearTop | ActivityFlags.SingleTop);
          var pendingIntent = PendingIntent.GetActivity(this, 0, intent, PendingIntentFlags.CancelCurrent | PendingIntentFlags.UpdateCurrent);
          Notification.Builder builder = new Notification.Builder(this);
          builder.SetSmallIcon(Resource.Drawable.icon_notification);
          builder.SetContentIntent(pendingIntent);
          builder.SetLargeIcon(BitmapFactory.DecodeResource(Resources, Resource.Drawable.icon_notification));
          builder.SetContentTitle("Test");
          builder.SetContentText(body);
          builder.SetDefaults(NotificationDefaults.Sound);
          builder.SetAutoCancel(true);
          NotificationManager notificationManager = (NotificationManager)GetSystemService(NotificationService);
          notificationManager.Notify(1, builder.Build());
  
      }
      catch (Exception ex)
      {
          Console.WriteLine(ex.Message);
      }
  }
  </code></pre>
  
  <p>At the moment background push notifications are handled perfectly. I am able to run a simple line in the <code>OnCreate</code> method within <code>MainActivity.cs</code> </p>
  
  <pre><code>Intent.GetStringExtra("view");
  </code></pre>
  
  <p>this gets me the value that was set in CreateNotification.</p>
  
  <p>The issue I come across is trying to get the intents on the foreground. This code resides on MainActivity.cs and is triggered when a push notification is clicked on the foreground.</p>
  
  <pre><code>protected async override void OnNewIntent(Intent intent)
  {
      base.OnNewIntent(intent);
  
      if (Intent.Extras != null)
      {
          foreach (var key in Intent.Extras.KeySet())
          {
              var value = Intent.Extras.GetString(key);
              Log.Debug(TAG, "Key: {0} Value: {1}", key, value);
          }
      } 
  }
  </code></pre>
  
  <p>Intent.Extras is always null, may I ask where abouts am I going wrong. </p>