It's everywhere that to let the OS kill the app or process is better.. but I didn't read or knew why.. anyone has more info.. what's the risk of exiting the app...etc.
I don't think that can be any risk (or disadvantage) closing explicitly your app (process).
Anyway, simply calling Activity.Finish you don't close the app, you need also to stop all services (and sometimes you don't know which services your app started, because it is possible that a library you added starts some service).
i did try to use exitapplication in my app .. the activity just reset
so one of the risk maybe , if you force exit/kill the app(services , activity) the os will reset it
i did try to use exitapplication in my app .. the activity just reset
so one of the risk maybe , if you force exit/kill the app(services , activity) the os will reset it
The OS will treat your app as if it has crashed when you call ExitApplication. In some cases it will try to restart it automatically.
Another advantage of Activity.Finish is that the os can keep the process running for some time. If the user returns to your app then it will not need to create a new process.
If you are targeting Android 4.1+ (API 16+) then you can use this code to close all activities:
B4X:
Sub CloseActivities
Dim jo As JavaObject
jo.InitializeContext
jo.RunMethod("finishAffinity", Null)
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.