[mobile] close application
I'm using Titanium.Network to detect if the user is online and if he is using MOBILE network, i'm displaying a warning dialog with two buttons: continue and exit.
How can i close the application when the user choose to exit?
I tried to close the only window i have created but the app still remains open and Titanium.App has no close or exit method.
Is it possible? Any tips?
Thank you
12 Answers
-
Titanium does not currently have an explicit exit method. In Android applications, users normally just hit the back button to exit an application.
-
@Don Throp> not true.
A bad example is Opera Mini. You follow 10 links so you have to press back button countless times to exit.
Also, with Titanium, what if we have a stack of 5 windows?
We have, again, to press the back button quite a few times.So, as i said, android apps have Exit option:
Dolphin browser, Nimbuzz, etc. all have it…We need it too.
In my case, how can i, at least, close the main window when the user decides that he doesn't want to continue?
-
I'll add more data. Firstly none of the Google applications provide an Exit button. So there is a de-facto standard. Here is a good article on When to Include an Exit Button in Android Apps (Hint: Never).
If your application is not visible, then it should be in a stopped state not consuming CPU. If Android decides it needs more resources it has the option to kill any/all processes. If you're app is stopped, it may not even have a process at that point it time. It's basically serialized and inactive.
Depending on the device, your application can never take more than its 16-24MB allotted RAM (currently). Killing it doesn't actually free up more RAM for other processes. The Android OS will simply dump your app if it's stopped and reclaim the RAM.
The user also has the option to simply switch to another app or press the home button. If they really want it killed, on 2.X devices they can use application settings to kill the app. Which is a last ditch effort to kill badly written applications.
All that said, we'll look into an exiting option. But, from an Android standpoint and the tenants that the OS developers and Google App developers work under, there shouldn't be an exit button.
-
Find a bug that crashes the app ;)
-
But on android that does not work either.
It is still running in the background. We just got an android and the Verizon rep actually recommended an app that will display all the apps that are running that it can kill them. -
This would be a useful (and basic) feature, I think. Few apps let you quit them, but it's still a nice feature.
Also being able to vote for and help prioritize features would be an awesome way to increase community involvement…
-
Don, any progress on the exit method. That'd be very useful for me too.
Thanks,
Alex
-
Use finish() method of current activity: http://developer.appcelerator.com/question/83911/titaniumappexit-for-android#204550
Closing an app is not only needed for a close button. I need it to close my app if device doesn't have a minimum resolution…
-
I'm going to resurrect this thread, as an application exit method would be very useful. There certainly is precedence for having one, Google Navigation itself has a Exit Navigation button in the bottom menu which exits the app!
-
Well, at least one case when exit would be very usefull:
I write this code to clean built-in remote images cache on sd-card
var dir = Titanium.Filesystem.getFile(Titanium.Filesystem.externalStorageDirectory); var cache_folder = dir.nativePath.toString()+'/remote-image-cache'; var deldir = Titanium.Filesystem.getFile(cache_folder); deldir.deleteDirectory(true);
it works, but if I exit app with back button or with
var activity = Titanium.Android.currentActivity; activity.finish();
At the next restart all images in my tableview is broken (empty)
I have to kill app with external method to have all works fine again.
So, having a kill method would solve my problem (I can't instruct my user to kill app with external program or restarting phone at all)
-
seems that Titanium fails if dir remote-image-cache isn't found, so a deldir.createDirectory(); after deldir.deleteDirectory(true); can be a workaround.
Exits app isn't really necessary anymore.
-
My application is closed and navigate to home screen using setting both [exitOnClose:true; OR Titanium.Android.currentActivity.finish();] but at settings->manage application->running it showing my application icon running list at back end so how to resolve this issue?I want when my application is gets closed at a time i want to stop back end running process also.please help me out.