0 Favourites

[PLUGIN] CocoonJS Android Back-button

  • Hi

    I've tested this on few projects and it looks ok so far. Please let me know if you have any problems.

    Instructions:

    Download the zip file from

    http://www.kaurismaa.com/scirraplugin/cocoonjsbackbutton.zip

    and extract it to

    C:\Program Files\Construct 2\exporters\html5\plugins

    After unzipping the files, you should see four files at

    C:\Program Files\Construct 2\exporters\html5\plugins\cocoonjsbackbutton

    Open your Scirra-project and select "Object types" from your project, right click your mouse and select "Insert new object".

    From "Platform Specific", select "CocoonJSBackButton".

    On your event sheet, add new event and select "CocoonJSBackButton". There is only one event available - "On back", which is triggered when user clicks Android phone back button.

    Please note this disables CocoonJS normal back button behavior, so yo need to implement your own app exit function e.g. "Browser" object's "Close" method.

    /timo

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Thanks for this! It works perfectly, no fuss. Only "issue" is that it only works in a compiled app, not in the CJS Launcher.

  • Could it be possible to directly integrate this into the CocoonJS plugin now that it's open source?

    EDIT:

    I can confirm that it works in the CocoonJS Launcher (2.0.2). GeometriX

  • I guess it could be possible. I have not been using or developing the CocoonJS plugin. If some CocoonJS plugin developer can add it, it could be just great:)

    /timo

  • I also confirm that it works in the CocoonJS Launcher (2.0.2).

  • Hi! I dont know why, but if i add the object CocoonJSBackButton, game starts with infinitely black screen (2.0.2), in version 2.1.1 infinitely black screen also flashes. Please help (, what i am do wrong

    UPD: all ok. it was my bad.

  • Hello,

    Could you please explain me why this plugin is needed? I can't see the point.

    In addition, if you want it to be included in the plugin, make a pull request and our developers will have a look at it.

    Regards.

  • Hellou Ludei!

    First of all, thanks for the cloud service! For my games, Ludei's CocoonJS service has been working mostly just great and I've been able to publish my games on Android and iOS.

    I don't know the current CocoonJS plugin situation, but few months ago it was not possible to detect back button click event when compiling Construct 2 games on Android using CocoonJS service. Due the reason of that, my games did not pass tests at Samsung App Store.

    If the back button is missing from current open source CocoonJS plugin and there is not too much trouble, I could be happy if it would be added there somehow.

    br,

    /timo

    /timo

  • Hello,

    Could you please explain me why this plugin is needed? I can't see the point.

    In addition, if you want it to be included in the plugin, make a pull request and our developers will have a look at it.

    Regards.

    There is a huge point why this would be important to be integrated: Google Play doesn't feature

    any games that have the back button not integrated correctly into an app.

    Correctly means that it must either work as a classic browser-ish back button (back to previous layout)

    or open an in-game query.

    Thanks for the plugin, I am going to try this one

  • Hi! I dont know why, but if i add the object CocoonJSBackButton, game starts with infinitely black screen (2.0.2), in version 2.1.1 infinitely black screen also flashes. Please help (, what i am do wrong

    UPD: all ok. it was my bad.

    Could you please explain why it was your bad? I am having the same issue. Game starts in a black screen after the Ludei splash logo when using the plugin.

    Mind sharing what you did to solve this?

  • Hello,

    Not sure if it is related, but I saw a line that might not be working anymore. Just in case, my recommendation is to update it, because it might affect sooner or later.

    As you know, we updated completely our C2 plugin, and the prelude was replaced. In addition, CocoonJS is no longer called like that inside the plugin, the object is called Cocoon.

    In the plugin, I saw this: CocoonJS["App"]["setAppShouldFinishCallback"](function ()

    It should be: Cocoon.App. exitCallback(function () ... or Cocoon["App"]["exitCallback"](function () ...

    Here is the documentation involved: http://doc.ludei.com/3.0.5/Cocoon.App.html#toc5

    Regards.

  • Hi Ludei,

    great support once again on your side, thank you very much.

    I replaced "CocoonJS["App"]["setAppShouldFinishCallback"](function ()"

    with "Cocoon.App. exitCallback(function ()"

    in the plugin and now it's working like a charm.

    androidtimo you might consider updating the plugin

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