moster67 Expert Licensed User Longtime User Feb 20, 2013 #1 In a different thread, Erel wrote: I recommend you to call Activity.Finish instead. ExitApplication kills the process. As you see the OS might try to restart it. Click to expand... I have been using Exit.Application in one of my apps and indeed sometimes the app restarts. I then changed this into Activity.Finish and this problem vanished. However, there are some drawbacks with Activity.Finish which creates some problems such as app and some resources not being closed immediately and therefore, although not recommended, I would much prefer using Exit.Application. Can someone explain to me why the OS might try to restart the app (process), technically speaking when using Exit.Application? Is it due to some message-queue or similar? Any way to change this behavior?
In a different thread, Erel wrote: I recommend you to call Activity.Finish instead. ExitApplication kills the process. As you see the OS might try to restart it. Click to expand... I have been using Exit.Application in one of my apps and indeed sometimes the app restarts. I then changed this into Activity.Finish and this problem vanished. However, there are some drawbacks with Activity.Finish which creates some problems such as app and some resources not being closed immediately and therefore, although not recommended, I would much prefer using Exit.Application. Can someone explain to me why the OS might try to restart the app (process), technically speaking when using Exit.Application? Is it due to some message-queue or similar? Any way to change this behavior?
Erel B4X founder Staff member Licensed User Longtime User Feb 20, 2013 #2 Which resources are not released? In almost all cases it is better to let the OS decide when to kill the process. If you do want to call ExitApplication then you should make sure that you first stop all services and activities and then call ExitApplication. Upvote 0
Which resources are not released? In almost all cases it is better to let the OS decide when to kill the process. If you do want to call ExitApplication then you should make sure that you first stop all services and activities and then call ExitApplication.
moster67 Expert Licensed User Longtime User Feb 20, 2013 #3 Erel said: Which resources are not released? In almost all cases it is better to let the OS decide when to kill the process. If you do want to call ExitApplication then you should make sure that you first stop all services and activities and then call ExitApplication. Click to expand... Well, my app uses a wrapped external library and despite using its Release-method, some times (not always) the resource is not released and this means that a satellite-receiver and its tuner remains occupied and the satellite-receiver cannot be used. This did not happen when I used Exit.Application but with Activity.Finish I have this unfortunate behavior. Probably Exit.Application ensures that indeed all processes are killed but some times it makes the app restart Upvote 0
Erel said: Which resources are not released? In almost all cases it is better to let the OS decide when to kill the process. If you do want to call ExitApplication then you should make sure that you first stop all services and activities and then call ExitApplication. Click to expand... Well, my app uses a wrapped external library and despite using its Release-method, some times (not always) the resource is not released and this means that a satellite-receiver and its tuner remains occupied and the satellite-receiver cannot be used. This did not happen when I used Exit.Application but with Activity.Finish I have this unfortunate behavior. Probably Exit.Application ensures that indeed all processes are killed but some times it makes the app restart
AllyAndroid Member Licensed User Longtime User Feb 22, 2013 #4 I'm new here and have only been using Basic4Android for a few days but have run into a similar problem. I have two activities: Main and Home. I wanted to give the user the ability to either Logout and go back to Main or Exit the app completely. If they chose to Logout, I was using Activity.Finish. If they wanted to Exit the app, I was using ExitApplication. However, regardless of what they selected, Main would always restart. Here is my solution that so far has worked for my app: For the Main module: I added to the Sub Process_Globals: Code: Copy Public killApp As Boolean Then I added this code to the Sub Activity_Create(FirstTime As Boolean): Code: Copy If killApp = True Then Activity.Finish End If For the Home module: I added this code: Code: Copy Sub btnLogout_Click If Msgbox2("Do you want to close the app?", "Close App","Yes","","No", Null) = DialogResponse.POSITIVE Then Main.killApp = True Else Main.killApp = False End If Activity.Finish End Sub Last edited: Feb 22, 2013 Upvote 0
I'm new here and have only been using Basic4Android for a few days but have run into a similar problem. I have two activities: Main and Home. I wanted to give the user the ability to either Logout and go back to Main or Exit the app completely. If they chose to Logout, I was using Activity.Finish. If they wanted to Exit the app, I was using ExitApplication. However, regardless of what they selected, Main would always restart. Here is my solution that so far has worked for my app: For the Main module: I added to the Sub Process_Globals: Code: Copy Public killApp As Boolean Then I added this code to the Sub Activity_Create(FirstTime As Boolean): Code: Copy If killApp = True Then Activity.Finish End If For the Home module: I added this code: Code: Copy Sub btnLogout_Click If Msgbox2("Do you want to close the app?", "Close App","Yes","","No", Null) = DialogResponse.POSITIVE Then Main.killApp = True Else Main.killApp = False End If Activity.Finish End Sub
Erel B4X founder Staff member Licensed User Longtime User Feb 22, 2013 #5 You should change ExitApplication to Activity.Finish. Upvote 0
AllyAndroid Member Licensed User Longtime User Feb 22, 2013 #6 Erel said: You should change ExitApplication to Activity.Finish. Click to expand... Thanks, I updated it. Upvote 0
Erel said: You should change ExitApplication to Activity.Finish. Click to expand... Thanks, I updated it.
peacemaker Expert Licensed User Longtime User Mar 28, 2013 #7 When TimeZone is changed when app (using time code constantly) is working - it needs to restart app for sure. So ExitApplication is required, but it needs to use it at each Activity start...i think. Upvote 0
When TimeZone is changed when app (using time code constantly) is working - it needs to restart app for sure. So ExitApplication is required, but it needs to use it at each Activity start...i think.
Erel B4X founder Staff member Licensed User Longtime User Mar 29, 2013 #8 ExitApplication will kill the process. If there is any service running then the process will be restarted. You should close all activities and services before calling it. Upvote 0
ExitApplication will kill the process. If there is any service running then the process will be restarted. You should close all activities and services before calling it.
mesutaslan Member Licensed User Longtime User Aug 4, 2013 #9 Erel said: ExitApplication will kill the process. If there is any service running then the process will be restarted. You should close all activities and services before calling it. Click to expand... How can i close all activites and services from 2.activity ? i wantto make a splash screen show for 5 secs. from begining of application. i make main activity as splash screen and after 5 secs. call the menu activity. in menu activity i catch the back key and prompt user "do you wantto exit ?" if negative "return true" if positive i wantto kill app but it restarts it self.. i am confisued but how can i kill all running procsess or services or etc. ? Okey, i handle it with this way : in main activity after i call 2nd activity with "StartActivity" i put the "Activity.Finish" so main activity finish itself and 2nd activity exit when user say "YES" Last edited: Aug 4, 2013 Upvote 0
Erel said: ExitApplication will kill the process. If there is any service running then the process will be restarted. You should close all activities and services before calling it. Click to expand... How can i close all activites and services from 2.activity ? i wantto make a splash screen show for 5 secs. from begining of application. i make main activity as splash screen and after 5 secs. call the menu activity. in menu activity i catch the back key and prompt user "do you wantto exit ?" if negative "return true" if positive i wantto kill app but it restarts it self.. i am confisued but how can i kill all running procsess or services or etc. ? Okey, i handle it with this way : in main activity after i call 2nd activity with "StartActivity" i put the "Activity.Finish" so main activity finish itself and 2nd activity exit when user say "YES"