Beja Expert Licensed User Longtime User May 15, 2017 #1 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.
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.
LucaMs Expert Licensed User Longtime User May 15, 2017 #2 Beja said: what's the risk of exiting the app Click to expand... 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). Upvote 0
Beja said: what's the risk of exiting the app Click to expand... 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).
R ronell Well-Known Member Licensed User Longtime User May 15, 2017 #3 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 Upvote 0
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
Beja Expert Licensed User Longtime User May 15, 2017 #4 ronell said: 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 Click to expand... Very interesting. So killing the process will rest the activity. too bad. Upvote 0
ronell said: 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 Click to expand... Very interesting. So killing the process will rest the activity. too bad.
Erel B4X founder Staff member Licensed User Longtime User May 16, 2017 #5 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: Code: Sub CloseActivities Dim jo As JavaObject jo.InitializeContext jo.RunMethod("finishAffinity", Null) End Sub Upvote 0
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: Code: Sub CloseActivities Dim jo As JavaObject jo.InitializeContext jo.RunMethod("finishAffinity", Null) End Sub