Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Android / Back button on Android

Author
Message
Java Man
8
Years of Service
User Offline
Joined: 20th Feb 2011
Location: Australia
Posted: 6th Feb 2014 00:59
I haven't converted my game to Android yet, but I notice with the AppGameKit Player that I can test for the back button, but it doesn't actually 'go back'. Is this how the finished compiled Android game will operate, or is it simply an AppGameKit Player quirk??
I need to make a pause screen and pause the physics engine..

If I only had the time...
Naphier
8
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 6th Feb 2014 03:25
The back key triggers raw key input in AppGameKit which means you have to test for that key press to know what to do. Put into code:

if GetRawKeyPressed(27) = 1
repeat
Print("PAUSED")
Sync()
until GetPointerPressed() = 1

//adjust your timers here
endif

Ancient Lady
Valued Member
15
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 6th Feb 2014 05:01
For all applications, not just AppGameKit based ones, I believe that it is generally up to the programmer to decide how to handle the 'back' button if it is captured and/or checked for.

I certainly get non-consistent behaviors across applications.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Java Man
8
Years of Service
User Offline
Joined: 20th Feb 2011
Location: Australia
Posted: 6th Feb 2014 06:22
Thanks for that. I understand the code, I was hoping to get some feedback on what happens in the real world with a fully compiled app. With AppGameKit Player the android device doesn't actually 'go back'. Is there extra code to shrink the app into the background??

If I only had the time...
Funnell7
7
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 6th Feb 2014 11:07
As AL has mentioned, the 'back key' is controlled by the programmer, you can do whatever you like when this key is pressed. For me, I either invoke the Pause Menu or Close the app, depending on where the user is within the app.

The 'home key' however, is different, you cannot control this. This key simply sends the application to the background and takes you back to your 'home screen'. No coding is required for this as this is an OS feature.

Login to post a reply

Server time is: 2019-08-24 05:16:23
Your offset time is: 2019-08-24 05:16:23