Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

FirebaseApp is not initialized on real devices

$
0
0

Hello! I'm trying to add push notifications in Xamarin.Forms.
On Genymotion it's work fine but on real devices i have an error:
Default FirebaseApp is not initialized.Make shure to call FirebaseApp.initializeApp(Context)

google-services.json is present in Android project with GoogleServicesJson BuildAction

My MainActivity:

     public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
        {
            internal static MainActivity Instance { get; private set; }
            internal static FirebaseInstanceId FirebaseInstance { get; private set; }

            public static int CurrentUserId { get; set; }
            protected override async void OnCreate(Bundle bundle)
            {
                base.OnCreate(bundle);           

                TabLayoutResource = Resource.Layout.Tabbar;
                ToolbarResource = Resource.Layout.Toolbar;

                VideoViewRenderer.Init();
                global::Xamarin.Forms.Forms.Init(this, bundle);
                string dbPath = FileAccessHelper.GetLocalFilePath("LocalDataBase.db");

                LoadApplication(new App());

                Xamarin.Forms.Application.Current.On<Xamarin.Forms.PlatformConfiguration.Android>().UseWindowSoftInputModeAdjust(WindowSoftInputModeAdjust.Resize);
                UserDialogs.Init(this);
                CachedImageRenderer.Init();           

            //on real devices it return  null
                var app = Firebase.FirebaseApp.InitializeApp(this.ApplicationContext);

                Instance = this;
            }

Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>