[Phonegap] Creating Android menu?

Get help using Construct 2

Post » Sun Jan 29, 2012 8:00 am

Is this possible?

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


B
11
S
3
G
2
Posts: 110
Reputation: 2,410

Post » Sun Jan 29, 2012 12:36 pm

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!)
B
5
Posts: 12
Reputation: 551

Post » Sun Jan 29, 2012 12:57 pm

@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).
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Sun Jan 29, 2012 1:04 pm

@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?
B
5
Posts: 12
Reputation: 551

Post » Sun Jan 29, 2012 4:48 pm

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? arcoidgames2012-01-29 16:48:48
B
5
Posts: 12
Reputation: 551

Post » Sun Jan 29, 2012 5:22 pm

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.
B
14
S
5
G
7
Posts: 235
Reputation: 5,175

Post » Sun Jan 29, 2012 8:26 pm

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?
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Sun Jan 29, 2012 9:04 pm

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
http://docs.phonegap.com/en/1.3.0/phonegap_events_events.md.html#menubutton
B
3
S
1
G
1
Posts: 1
Reputation: 986

Post » Sun Jan 29, 2012 11:11 pm

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! :)ranma2012-01-29 23:13:18
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Post » Mon Jan 30, 2012 3:52 am

@Ashley

All I needed to hear.

Thanks. :)
B
11
S
3
G
2
Posts: 110
Reputation: 2,410

Next

Return to How do I....?

Who is online

Users browsing this forum: Justin1967, qaisarehman and 33 guests