Load startup model in platform project code and pass it to PCL on Xamarin Initialization RRS feed

  • Question

  • User389131 posted

    The application I'm currently working on requires data to be retrieved from a web service during app startup that roughly takes 1.5 seconds. After the data is retrieved, it needs to be displayed on the MainPage and that is another 1.5 - 2 seconds since the data is mostly URLs of images that have to be displayed, in my case, using ffimageloading library; which means actually downloading those images first to be displayed. I have splash startup screens for both Android and iOS implemented separately in platform projects but splash screen only stays up for the amount of time Xamarin Forms needs to load and afterwards disappears not waiting for my actual model to load from the web service. I have searched for solutions to extend the splash screen duration and mostly every solution I have read involves creating another splash screen page, loading page if you will, that is already controlled in PCL project but having two separate splash loading screens just seams not feasible for me at the moment. So I was wondering, how would one load the initial model in platform projects, during the actual splash screen, and then later pass it to PCL project when Xamarin Forms has finished initialization, presumably to App.xaml.cs 's App() constructor function?

    Monday, March 30, 2020 9:40 AM

All replies

  • User369978 posted

    You can create a new Activity/ViewController(same background as splash screen) to handle the logic(download image etc.) ,and pass the data via messaging center to Forms project when everything was completed .

    Tuesday, March 31, 2020 9:40 AM