Navigation.Popasync() does not work when used as an option to exit the application

Asked

Viewed 97 times

-2

I have a one-screen app, a "Contentpage".

I can’t get out of the app with "Popasync()".

I’m debugging on a Samsung J6 device.

// página instanciada
MainPage = new NavigationPage(new Inicio());

// opção usada para sair do aplicativo
private async void Sair(object sender, EventArgs e)
{
  await Navigation.PopAsync();
}
  • 1

    if there is no other page on the navigation stack, it seems that a pop... to close the application: https://stackoverflow.com/a/30571114/4713574

  • My Visual Studio does not recognize the "OS" object/method: "Android.OS."

  • Or is missing import a namespace using Android.OS;, Using Namespace, or missing reference to an Assembly, how to reference an Asssembly,

3 answers

0

Hello @Domingos Neto,

As has already been said, Navigation.PopAsync() is a method to pop windows in your application, since there is only one window such method will not be useful.

Regarding your "programmatically close app" approach, what I can say is that this is not an approach recommended by stores primarily by Apple (more details through the link), because such behavior can be seen by the user as a crash (unexpected failure), so your app may even be rejected during the posting attempt.

I have already gone through this, and explained to my superiors what I said above and such "functionality" was disregarded.

0

I advise not to use internal methods to close the application, Apple will bar the application and have a chance google do the same.

0

Hello. I use the code below to exit and close an App.

// opção usada para sair do aplicativo
private async void Sair(object sender, EventArgs e)
{
  System.Diagnostics.Process.GetCurrentProcess().Kill();
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.