I can’t get out of the mobile app

Asked

Viewed 50 times

0

I have following problem with phonegap, while trying to execute the following instruction:

navigator.app.exitApp();

The android just leaves in the background the application, the screen fades even more is in the background, IE when I click on the button to show the open applications it is still there

Can someone help me

1 answer

1


Jacob, this happens because you cannot "close" an application, only the Android system that can decide when an application will exit the stack, the fact that the application is in the tab of recent applications, does not mean that it is running in the background.

I don’t really know how Phonegap works, however, it certainly runs within an Android Activity, so I advise to take a look at Life Cycle of an Activity to better understand how Android manages your application.

  • Thanks Lucas I’ll see that link

  • The important thing is to always keep in mind that you do not control the application lifecycle, so when it is no longer visible the system can destroy it at any time (in case the system needs resources for the application in the foreground)then if you need to do something before the application closes, use the methods onStop or onDestroy

Browser other questions tagged

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