简体   繁体   中英

Performance improvement of Xamarin forms application

I am developing an Xamarin forms (Android and iOS) applicaion and checking the logged in status when application starts and assign the appropriate values if the user already logged in to application. This process takes 6 seconds to load the first page in our application. I have followed the Xamarin Auth to store the credentials of the user when logged in.

Below is the procedure to store and retrieve the details of logged-in user that I've used in the application.

https://developer.xamarin.com/recipes/cross-platform/xamarin-forms/general/store-credentials/

Code snippet which is used in OnStart method of App.cs file:

        protected async override void OnStart()
        {
            LoginType login = DependencyService.Get<ILoginCredentialStorage>().LoginExists();
            this.MainPage = new NavigationPage(new HomePage(login));
        }

How can I reduce time to load the first page in application?

You probably need to move the getting of the login credentials to the login page, and leave it as late (ie OnAppearing rather than the constructor) as possible to do that so you can show a progress indicator.

Here are some more tips

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM