How to access to Android's back button?

Get help using Construct 2

Post » Fri Nov 30, 2012 8:02 am

I recently received an update email from CocoonJS saying that the Android back button is now supported. So my question is how do I do it in c2?
B
7
S
2
G
1
Posts: 18
Reputation: 1,340

Post » Tue Feb 05, 2013 6:16 am

@Ashley. Please, would it be possible to implement the application quit control/back button API for CocoonJS in the CocoonJS plugin?

Control over what the back button does is quite important for a consistent user experience in Android.

From Ludei's blog (http://blog.ludei.com/):

"Application quit control

In Android (not in iOS) the back button can be used to destroy the activity. Now, there is a way to control this behavior from JavaScript. The default behavior has changed and now, if the developer does not specify anything, CocoonJS will prompt a dialog and pause the application to let the user decide if the app should be destroyed or not. Moreover, the developer now has the possibility of specifying that he/she wants to take control of the app finalization. The process is as easy as specifying a function that will return a boolean by calling

CocoonJS.App.setAppShouldFinishCallback(FUNCTION_THAT_RETURNS_A_BOOLEAN)
.
If the function returns true, it means the app should finish and if it returns false, it means it should not finish and that the developer takes control of the finalization. Whenever a developer wants to finish the application, there is a function called

CocoonJS.App.forceToFinish

This feature is specially useful in Android (in iOS for example none of the functions will work)."

It would be nice to have the condition:
"On Back Button Pressed"
- so we cab specify what it does.

and the action:
"Close Application"

Control over this would give us massive boost in terms of how professional our apps look compared to the stock Android "Are you sure you want to exit?" dialogue box.

ThanksNathan2013-02-05 06:27:00
B
29
S
8
G
4
Posts: 61
Reputation: 6,205

Post » Wed Apr 24, 2013 5:09 am

Bump. @Ashley

Please can you implement back button control as a Cocoonjs feature?

It makes the game look more professional and is actually essential in order to get featured on Google Play. Also at game exit is the optimal place to place a full screen ad and make revenue.
I'd really like to make enough revenue to upgrade to a business license. ;-)

Thanks Nathan2013-04-24 05:11:24
B
29
S
8
G
4
Posts: 61
Reputation: 6,205

Post » Tue Apr 30, 2013 6:00 pm

bump bump bump!!!

Would love to see this implemented..
B
6
Posts: 20
Reputation: 815

Post » Mon Jun 17, 2013 2:15 am

You have my vote too. I agree that this is very important feature.
B
26
S
5
G
5
Posts: 151
Reputation: 6,279

Post » Thu Jun 27, 2013 7:31 am

As there hasn't been any further discussion on this import feature, I was wondering whether it is possible to create a plugin for this specific behaviour?
B
26
S
5
G
5
Posts: 151
Reputation: 6,279

Post » Sat Jul 06, 2013 4:03 pm

I think is very important this feature...
is very important integrate all button from device in construct2, because the developer need to access this for edit the game and select options (save game, load game, options...)

sometimes, is possible to make a button on screen for this work but is different, the back button is working only quit game for now.

I hope, in short time is possible to edit the button function in android and another device!

Contruct2 is the bestRibis2013-07-06 16:05:26
B
11
S
3
Posts: 278
Reputation: 2,068

Post » Thu Jul 18, 2013 5:04 pm

bump. bump!
I have a client who's kinda annoyed that I can't do this :/
B
5
Posts: 18
Reputation: 821

Post » Thu Sep 12, 2013 3:33 pm

Guys how to make on back pressed in cocoonjs
B
5
S
2
G
3
Posts: 53
Reputation: 2,468

Post » Tue Nov 12, 2013 12:17 pm

Hi all,


Is there a solution for this already?

Thanks! P.s. i want to use Phonegap.
B
10
S
4
G
3
Posts: 163
Reputation: 2,507

Next

Return to How do I....?

Who is online

Users browsing this forum: Zebbi and 21 guests