Firebase Cloud Messaging with Xamarin.Android RRS feed

  • Question

  • I'm new to Xamarin and trying to send push notifications to my app from Firebase. I set up a mobile app on the Firebase console and gave it the same package name as my visual studio project, "RoomCheck.RoomCheck". I downloaded the google-services.json file and followed the "Remote Notifications with Firebase Cloud Messaging" tutorial from Xamarin to set up the app to receive notifications.

     Here is the code I added to the android  manifest:

    <application android:label="RoomCheck" android:theme="@style/MyTheme">
    		<receiver android:name="" android:exported="false" />
    		<receiver android:name="" android:exported="true" android:permission="">
    				<action android:name="" />
    				<action android:name="" />
    				<category android:name="${applicationId}" />

    I added this class to the project, as per the tutorial:

    using System;
    using Android.App;
    using Firebase.Iid;
    using Android.Util;
    namespace RoomCheck
        [IntentFilter(new[] { "" })]
        public class MyFirebaseIIDService : FirebaseInstanceIdService
            const string TAG = "MyFirebaseIIDService";
            public override void OnTokenRefresh()
                var refreshedToken = FirebaseInstanceId.Instance.Token;
                Log.Debug(TAG, "Refreshed token: " + refreshedToken);
            void SendRegistrationToServer(string token)
                // Add custom implementation, as needed.        }

    An in the main activity, in the OnCreate method, I tried:

                Log.Debug(TAG, "InstanceID token: " + FirebaseInstanceId.Instance.Token);

    Google play services is definitely available,  I tried the method in that tutorial to check. However, when I try to get the instance token in my main activity, I get an error on the last line above stating "Default FirebaseApp is not initialized in this process RoomCheck.RoomCheck. Make sure to call FirebaseApp.initializeApp(Context) first." This is despite the fact that I have already called FirebaseApp.InitializeApp.

    Is there another step in the setup that I have missed out on? Or is it a problem with the package name, such as it has to be in a certain format?

    Saturday, April 29, 2017 3:19 PM

All replies

  • Hi katiemorris,

    Welcome to the MSDN forum.

    Refer to your description, your issue is about the development of Xamarin. Since our forum is to discuss the VS IDE, please redirect this appropriate forum: and start a new thread for your issue. You will get a more professional support from there, thank you for your understanding.

    If you have any other issues about VS IDE in the future, please feel free to let me know.

    Best regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Monday, May 1, 2017 5:28 AM