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