Amazon Modifications

So my game is nearly done. I am wanting to target iOS and the Kindle Fire. How would I implement an exit button? In another post Peach said that for iOS one would use:
[lua]local function quitGame ()
os.exit()
end
myButton:addEventListener(“tap”, quitGame)[/lua]
Would I use the same thing for the Kindle?

Much appreciated,
J.K. [import]uid: 66117 topic_id: 19027 reply_id: 319027[/import]

Hi,

First, make sure you *do not* have an exit button for your iPhone/iPad app…you’ll get rejected because it violates their ios usability guidelines.

As for kindle, the code, as you have it, should work fine.
Enjoy :slight_smile:

Free Indie Game Dev Podcasts
http://www.indiegamepod.com
[import]uid: 12700 topic_id: 19027 reply_id: 73405[/import]

Thanks Indie [import]uid: 66117 topic_id: 19027 reply_id: 73416[/import]

I recommend that you do NOT use os.exit(), because that is the equivalent of doing a “Force Quit” on OS X or CTRL+ALT+DEL “End Process” on Windows. It’s not a nice way to exit a program.

Use the following function instead…
native.requestExit()

This will close the app gracefully on Android. On iOS, this function does nothing, which meets the Apple guidelines. [import]uid: 32256 topic_id: 19027 reply_id: 73471[/import]

@ Josh,

I tried that code and it didn’t work. Does it only work on the device? [import]uid: 66117 topic_id: 19027 reply_id: 73630[/import]

Correct. The “native.requestExit()” function only works on an Android device. It does not work in the Corona Simulator. Trust me, this is the best method to use. :slight_smile: [import]uid: 32256 topic_id: 19027 reply_id: 73686[/import]