A modal page appears above the current page and requires dismissal before normal navigation continues. Its lack of navigation UI signals that the current task should be completed first. section 8.1.1
Use modal navigation when the user must finish or dismiss a focused task:
- Push a LoginPage modally when the application starts, rather than registering it as a normal navigable route. section 8.1.1
- Call PopModalAsync after successful login to reveal the existing Shell. section 8.1.1
- Remember that Android may still provide a hardware or system back button, unless that behavior is overridden. section 8.1.1
Require login at startup
Override OnStart and call await MainPage.Navigation.PushModalAsync(new LoginPage()). After successful authentication, call await Navigation.PopModalAsync() from LoginPage. section 8.1.1
Listing 8.6 The OnStart functionality to add to App.xaml.cs
protected override async void OnStart()
{
base.OnStart();
await MainPage.Navigation.PushModalAsync(
new LoginPage()); #1
}
Inspect the startup code that pushes LoginPage onto the modal navigation stack. section 8.1.1
