FCM Notifications custom data as Android Intent.Extras

Nando779Nando779 USMember
edited January 2017 in Xamarin.Android

I am trying to receive the custom data (Advanced Options) I pass from the FCM Notifications console (key value pair) in my Android app via notification . I am following the example provided:

https://developer.xamarin.com/guides/android/application_fundamentals/notifications/remote-notifications-with-fcm/

See Handle Notification Intents section:

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); } }

My code is exactly above in my MainActivity OnCreate method.

It is my understanding the Intent.Extras.KeySet() should contain the key value pair I set as the custom data in the notification. Intent.Extra is always null even if I pass custom data from the FCM Notification console. Anyone get this to work?

Posts

  • DP_squaliDP_squali USMember

    The problem is still there.
    Come è possibile utilizzare FCM utilizzando Xamarin?

  • ThiagoMacedoThiagoMacedo USMember

    @Chris_H said:
    I had this issue and the problem was that I had a SplashActivity that was set as the launch activity and was getting the Intent.Extras, which I had to pass on to my MainActivity.

    Your answer SAVE MY WEEK! =D
    I was not getting Extras inside MainActivity because SplashActivity was my launch activity.

Sign In or Register to comment.