[Phonegap] Creating Android menu?

0 favourites
From the Asset Store
A well commented template with list menus and shops to use in your top-down RPGs or metroidvania games!
  • Is this possible?

    i.e. click the menu button on the android in my app and have a custom set menu I have built?

  • Yeah I'd like to know this too - is there any way to map commands to Android hard-keys such as the Menu button, and also the Back button?

    Also, when I export to PhoneGap, I can play the game I made and it works very well, but if I hit the Home button on my Android device, the game stays in memory and eats a huge 50% of the CPU in the background, so is there a way to ensure the Home button also properly exits the game/process?

    (sorry to hijack your thread, Khaz, but I suspect you'll want to know all this too at some point!)

  • arcoidgames, the home button issue is a problem of phonegap not consruct, as far as I know html5 has no way to directly access the functions of the android os (or iOS).

  • 0plus1, Yeah I thought as much, to be honest. I was busy hammering away at knocking out a 'test' game to see how it went, and it all seemed fine - up until that point.

    Do I take it then that, currently, C2 > PhoneGap > Android is not really a valid and workable solution?

  • Forgive my total ignorance here, and if I'm way off the mark, I apologise - I realise I'm like a six-year-old asking how to make bananas...

    I just played a game on Android that was build using Impact, which is an HTML 5 Game Builder. I noticed that it used the Android menu button to trigger the in-game menu...

    So, it *must* be possible.

    ...right?

  • I'm interested in this as well. Specifically,

    1. Is there a way to write HTML 5 code such that the page intercepts the Menu, Back, and Search of the Android device?

    2. Does C2 support this?

    If #1 is possible, then I think it's C2 issue, not Phonegap issue.

  • We can add support for these button pushes, added to the todo list. However apps should go dormant when not viewed and stop using CPU, are you sure that always happens?

  • Phonegap allows the Menu button to be accessible on HTML5 Apps, so Construct would just require this function

    I might built it into a plugin

    // Phonegap Docs

    docs.phonegap.com/en/1.3.0/phonegap_events_events.md.html

  • actually if only you could send data FROM javascript TO the canvas somehow it would work and also it would help writing custom functions for phonegap / appmobi using their apis. right now you can call JS from canvas (callJS, geturl) but you cannot receive data from js. I'd be more than happy to see construct condition like "on javascript function called 'menuButtonClicked'" and then in the javascript outside of construct you could do for example:

    document.addEventListener("menubutton", cr.menuButtonClicked, false);

    and the above problem would be solved! :)

    also this would work with back button and search button, even volume buttons or other events, you could use geolocation in construct, just imagine C2 app with GPS! :)

  • Ashley

    All I needed to hear.

    Thanks. :)

  • Ashley, yes, it always happens. If I hit 'Home' during the game, and leave the phone for even 30 minutes, I can go back to it and view Usage, to see that the app is still hogging CPU - and presumably battery too.

    Happily send you the APK, however embarrassing it happens to be in it's current state :)

  • Just to note, I have checked my Android and I do not have this issue.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey, any updates on this?

    As in, has anyone managed to find a way to respond to the Android Menu key (not Home key) in C2 packaged with PhoneGap?

    I understand it's on Ashley 's todo list - in the meantime, any workarounds?

    I am not interested (for now at least) in the Home key or the app going dormant etc. I would like to intercept the Menu key, to display a proper menu. Back key would also be very useful to intercept - I could use it for example to return the user to the previous layout in situations where it makes sense, instead of having them land on the Home screen.

    The Android app user intuitively expects that the Menu key will pop a menu and the Back key will get them back in the app, not all the way back to the Home screen.

    Thanks.

  • I am also very interested in this. My primary reason for using C2 is to make mobile apps so this will be a big step.

  • You can learn PhoneGap and compile yourself. :p

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