How to close the app correctly?

SeaDooFan

Member
Licensed User
Longtime User
I have noticed that even when I close my app by pressing the back or home button on the phone, it still seems that it keeps running somewhere in the background. For example, my app uses camera and gps, but even after I close it, the gps icon keeps blinking and sometimes the camera application says that the camera is buys.

Any ideas is there is some certain closing procedure, so that after pressing the back or home button on the phone, my app would be really closed?

Thanks! :)
 

Gary Miyakawa

Active Member
Licensed User
Longtime User
Do a quick search on activity.finish and exitapplication .. You should find your answers there...

My app uses activity.finish (which, my understanding, tells Android that I'm done and throw me away when you want)... Exitapplication kills the app immediately (and I'm not fully aware of any bad things that this might cause)..

Gary M
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
ExitApplication kills your application process, while Activity.Finish closes the current activity. It is better to close all modules and allow the OS to kill the process as it needs.

When working with multiple modules and calling ExitApplication, Android may automatically create a new process and restart your program.
 
Upvote 0
Top