I have a login page made with XAML in Xamarin.Forms. What I want is that after the user logs in, the app redirects to a page in Android.
How can I achieve this?
Thanks in advance
The EmployeeDirectory sample has a login page... it is presented modally over the main app, and only disappears after successful login (well, it's a 'fake' login because it's a sample, but you know what i mean).
The rest of the app's page structure can then be whatever you like - navigation stack or whatever.
Thanks for the answer, but...
The sample does not reflect my scenario. In the sample the login page is built in the Android app. In my case the login page is built in Xamarin.Forms.
@MartinUshima The login page in that sample is built with Xamarin.Forms - there is both a C# and a Xaml version in the EmployeeDirectoryUI project.
Ignore the *Activity.cs files in the Android project - those are left-over from when the project was ported to Xamarin.Forms - if you open the solution you will see those files are not used (I will get them deleted to avoid this confusion in the future).
Alternatively, check out my simplified version which also has the same modal Login pattern.
I like this approach.
One thing id like to run by you is how would you modify this if you wanted to also have a Register Page. My thinking is that there should be a WelcomePage that can take you to a LoginPage and/or a RegisterPage. But then after a successful login you would have to PopModalAsync twice (one to Pop the LoginPage and one to Pop the WelcomePage, hence you are back on the MainPage which will have the core experience of the app for logged in users). This certainly works but Im wondering if you have a better alternative to avoid this dual Popping of Modal Pages.
Thanks, I'll check it out again.
@IgnacioFuentes to keep things really simple I'd consider having two views embedded in that page, and using visibility show/hide the correct view (Login or Register). This way you only need one modal popup and can easily let the user switch between them. A cute idea might even be a carousel to let them swipe between login & register, but that's pretty non-standard.
@CraigDunn, yes. That seems like a good idea.
The only problem is that the back button will, at least by default, take the user back to the MainPage, which is not what we want as that page will not have any content yet. Thanks for your help, by the way
Xamarin Inc., as a wholly-owned Microsoft subsidiary acting as a separate legal entity, adheres to the Microsoft Privacy Statement: Privacy & cookies