x


Exit function for iPhone or Android app

How do you terminate the current Unity app on the iPhone or Android? How do you make an app close itself?

more ▼

asked Jan 13 '11 at 04:21 AM

ina gravatar image

ina
3.4k 499 554 615

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

Apple's policy does not allow this. You should always use the Home button. If you want to prevent an app from continuing to run in the background (although it's being paused then) after hitting Home, search the web for UIApplicationExitsOnSuspend. Setting this will quit the app when pressing Home.

EDIT: Haven't worked with Android yet. If Application.Quit() is not ignored on Android, and the application keeps running when hitting the Back button, you can try to quit the app in OnApplicationPause(), but not sure.

more ▼

answered Jan 24 '11 at 08:24 PM

Wolfram gravatar image

Wolfram
9.1k 8 20 53

Application.Quit is (silently) ignored on android :( - it brings you back to homescreen, but if you hold the home button to see the multitask apps, the unity app is still running!!

Jan 25 '11 at 07:09 AM ina

Though, i have noticed some errors on the Galaxy, not sure on other android phones, but the proper way to exit an App it to go "Back" all the way to the home screen, this is the way the program should "Close" itself without suspending it in memory.. but after the last Android update, it has stopped doing this and it sits in memory where i have to manually close it...

..So application.Quit() could work potensially?

Feb 10 '11 at 03:14 AM Matthew 5

I got this to work. I just called Application.Quit() but I put it in a loop so it executes multiple times. Such as: if (isQuitting) { Application.Quit(); } And just have a button to set the isQuitting to true.

Jul 25 '11 at 01:13 AM matrix211v1

@matrix211v1 - i wonder if apple, since their policy does not allow the quit option in an app, would reject that in app review?

Jul 25 '11 at 03:55 AM ina

I don't see that running on my Android. It does show it as a "recent app" when I get my home button. When I look at the Application, Management I do not see it running.

Jul 25 '11 at 04:22 AM matrix211v1
(comments are locked)
10|3000 characters needed characters left

Hit the Home button, or whatever the Android equivalent is. I don't know anything about Android, but iOS apps do not have any sort of software quit options.

more ▼

answered Jan 13 '11 at 04:24 AM

Jessy gravatar image

Jessy
15.7k 72 95 198

When you have multitasking, you want to have an exit option so the user doesn't just have that app hanging in memory.

Jan 13 '11 at 04:28 AM ina

@ina: the iPhone handles memory for you. You don't have to do anything. If memory runs low, it quits apps as needed. If you're manually closing apps, you're doing it wrong.

Jan 13 '11 at 05:29 AM Eric5h5

Well, if a user wants to be neat and organized and exit an app, there ought to be a way to exit.. Are you saying there's no way to create an exit button for Unity android/iphone?

Jan 13 '11 at 06:08 AM ina

Double-tap the home button, hold your finger down, and tap the minus icons in the multitasking bar.

Jan 13 '11 at 01:41 PM Jessy

in other words, unity iphone can't close itself...

Jan 13 '11 at 09:15 PM ina
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2609
x2013
x431
x58

asked: Jan 13 '11 at 04:21 AM

Seen: 7986 times

Last Updated: May 16 '12 at 10:12 PM