I get the same null error when I call VerifyPhoneNumberAsync() regardless of where I initialize CurrentActivity.
Adding the var activity = CrossCurrentActivity.Current.Activity ?? throw new NullReferenceException("current activity is null"); line in my MainActivity.cs directly throws no error.
It works fine for the Xamarin.iOS project, but for Xamarin.Android, the VerifyPhoneNumberAsync() call
is throwing "current activity is null" from the
CrossCurrentActivity.Current.Activity ??
check in https://github.com/f-miyu/Plugin.FirebaseAuth/blob/master/Plugin.FirebaseAuth.Android/PhoneAuthProviderWrapper.csPlugin.CurrentActivity is initialized (formerly in MainActivity.cs but now in MainApplication.cs as recommended) with no errors as per instructions in https://github.com/jamesmontemagno/CurrentActivityPlugin:
MainActivity.cs OnCreate():
MainApplication.cs OnCreate():
I get the same null error when I call VerifyPhoneNumberAsync() regardless of where I initialize CurrentActivity.
Adding the
var activity = CrossCurrentActivity.Current.Activity ?? throw new NullReferenceException("current activity is null");
line in my MainActivity.cs directly throws no error.Is there anything else I could be overlooking?
Dependency Versions
Plugin.FirebaseAuth 1.1.2 Xamarin.Forms 4.4.0.991265