0 Favourites

How to access to Android's back button?

  • 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?

  • 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.

    Thanks

  • 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

  • bump bump bump!!!

    Would love to see this implemented..

  • You have my vote too. I agree that this is very important feature.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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?

  • 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 best

  • bump. bump!

    I have a client who's kinda annoyed that I can't do this :/

  • Guys how to make on back pressed in cocoonjs

  • Hi all,

    Is there a solution for this already?

    Thanks! P.s. i want to use Phonegap.

  • up up up <img src="smileys/smiley1.gif" border="0" align="middle" />

  • BUMP

    is there a C2 native solution for back button support on mobile? This is the thread that comes up in google search results. Apologies if my google-fu has failed and it has been answered elsewhere.

    [Resolved] This has since been added to the browser object, and I did not think to look there.

  • BUMP

    Ashley

    is there a C2 native solution for back button support on mobile? This is the thread that comes up in google search results. Apologies if my google-fu has failed and it has been answered elsewhere.

    I never tried this but I just happen to use browser object now and saw home button and back button from browser object. Have you tried this?

  • Dur, I'm going to have to self reference my own post.

    -_-

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)