Hi everyone,
I'm building an application in Xamarin Forms PCL and having an issue for the moment and even after reading a lot of threads, i'm not sure how i can do this right. Here's the context of my application:
A user start the application, he has to log into the application. Once he's logged, i'm storing a key provided by a web service in the local storage. When the user start later again the application. The key stored in the local storage has to be checked by a web service method to know if it's still a valid key. If the key is valid, the user will be redirect to the main page. If there's no key, or the key is invalid, he'll be redirect to the login page.
My main problem is that the key validation is made by asynchronous method (web service call), and has to be before pushing the first page. The i'm in a static synchronous context (App.cs) and i get a dead lock.
Maybe i'm missing something or I should do it another way ?
I already tried to push a main page, then check if user is logged or not and push modal async a login page. But i had issue such as the user could come back to login page when he was logged (windows phone with a Tabbed Page as root page), or you could see the main page before the push of the login page due to the delay between page pushing. So i choose to push the right page in the first place.
Thanks, and pardon my english.
Best regards,
Armand