Closed Kapusch closed 10 months ago
I think the same thing happens to me on iOS on android it seemed to work fine..., the plugin "takes time to start". Sometimes I got an exception when using this code at startup:
CrossFirebaseCloudMessaging.Current.CheckIfValidAsync();
CrossFirebaseCloudMessaging.Current.SubscribeToTopicAsync("Topic");
Because firebase was not started. I had to put the above code in the OnAppearing
of one of my views and problem solved. Are you experiencing the same problem?
Hey @Kapusch, I didn't have any problems when initializing the plugin the way I've described in the Readme, but I think you are completely right that initializing it in iOS.WillFinishLaunching()
is more similar to the startup process on android and also to the plugin version before Maui 👍
If there is noone who has a case against putting the initialization call in iOS.WillFinishLaunching()
I will update the Readme accordingly.
I'm also using WillFinishLaunching
instead of FinishedLaunching
.
Hi @TobiasBuchholz !
I'm now migrating my app to MAUI, and I have noticed a different behavior between Android & iOS when initializing your Plugin. Currently, you're suggesting to register Firebase services in MauiProgram.cs using
ConfigureLifecycleEvents()
:However, from the documentation,
iOS.FinishedLaunching()
means the app has already launched, while I understandandroid.OnCreate()
it means the activity is created, but startup is NOT completed.I've been doing some tests and I think the equivalent of
android.OnCreate()
for iOS isiOS.WillFinishLaunching()
. Indeed, this solved an issue in my app where "Firebase is not yet configured" while I'm fetching Remote settings from the App.xaml.csOnStart()
method.One more clue is that, while working with the Xamarin.Forms version of your Plugin, we had to initialize the Firebase services from AppDelegate.cs on iOS, inside
FinishedLaunching()
method, NOT after.Am I wrong doing this ?