I'm working in an Android WebApp using Phonegap. To exit the application, I'm calling navigator.app.exitApp
from JavaScript code.
I tried to find the documentation page for this method, but it does not exist. Then I downloaded the Phonegap source code for Android, but I got lost without finding where and how does this library exit the app from native code. I've no time for this so I decided to test it on my own.
My app has a single DroidGap activity (launched with singleInstance flag), but also a Service and a Broadcast Receiver. The user must be able to close the GUI, but I'd like to keep the services and everything else running. So what I'd like to do is to finish only the activity, instead of calling System.exit
.
Now here comes the odd part. I've tested this in a simulator and the DroidGap activity seems to close the way I want it to (onDestroy is fired) and the services are kept running. But, despite the activity is closed, and the app icon is no longer shown in the task manager, somehow a JavaScript timer is still running. I've triple-checked this. I'd like to believe the activity is in the background, but it can't be: it is launched as singleInstance, and when I open the app again it shows the initial page (it was closed in a different page).
Why does this happens? Should I code a plugin to directly call finish
over the activity?
Thanks in advance.