I'm stucked with usage of plugin Acr.UserDialogs in android app, based on MVVMCross. In PCL project i used IUserDialog in viewmodel constructor injection.
I have installed Acr.UserDialogs package both in PCL and in Droid project, but when i run app, it throws:
In android, you must call UserDialogs.Init(Activity) from your first activity OR UserDialogs.Init(App) from your custom application OR provide a factory function to get the current top activity via UserDialogs.Init(() => supply top activity)
I tryed to call in my viewModel:
UserDialogs.Init(this);
But Init is not recognized And calling of UserDialogs.Instance.Loading ().Hide(); in app throws the same issue.
How it should be initialized in android project?
Upd: Final solution to workaround this looks like:
- In PCL project App.cs add: Mvx.RegisterSingleton(() => UserDialogs.Instance);
- In Your first loaded activity in OnCreate add: UserDialogs.Init(() => this);