PhoneGap: Need to 'pause' game when phone calls

0 favourites
From the Asset Store
Basic clone of a 80's arcade game called Gyruss that was quite fun to play!
  • Hi,

    I wonder if I could post a suggestion for a new feature (or fix) for CS2 please? (Or if it already handles this, then this is simply a question about how it's done....!)

    Basically, CS2's support of mobile gaming is improving every day, and the recent fixes to the PhoneGap audio support are very welcome. However, there's another side to mobile gaming which is somewhat crucial.... the need to pause the game (and particularly the audio) when an 'interrupting event' occurs on the phone - for example an incoming phone-call, or the user simply 'backing out' of the running game to access some other app.

    As far as I can see, currently CS2 games, exported to PG, and run on Android (for example), have their audio and gameplay continuing whenever the user 'pauses' the app or a phone-call comes in. This is problematic enough for various App stores to reject such a game (as it is crucial to deal with phone-call interruptions).

    Using PhoneGap it is quite easy to handle these incoming events, but it needs some code in the JS to listen to the events and respond to them, and whilst I could dive into the exported index.html and JS files generated by CS2 and add in some code to manage this.... ideally CS2 would simply handle the events and apply some code to silence the sound effects, and pause the game, whenever one of these events occurs (and restart it all when the user returns).

    The PhoneGap docs describe the events here:

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

    So... (Ashley in particular)... could this be something to add to a new CS build please? (Preferably ASAP... as it's a blocking issue with releasing mobile versions of CS2 games on iPhone/Android etc.)

    OR... if I've completely missed an existing feature within CS2 that handles such events, perhaps someone could simply point this numbskull in the right direction? :-)

    Thanks! (And my apologies if I've posted this in the wrong section... I'm happy to move it or repost)

    Ian

  • Write Ashley to attract his attention, he gets an alert when you write that. In fact, you can do that to everyone.

    Go2Holidays <-- see how that makes you get a notification?

  • Wow.... so it does! Thanks for the tip. Here goes then...

    Ashley Hi, what do you think of my PhoneGap suggestion? :-)

  • Firstly I thought mobile browsers were clever enough to pause the game when something else comes to the foreground. So I guess they are not very clever.

    Secondly I had no idea this could get you rejected from the app store! So I'll try and fix this ASAP.

  • Hi Ashley,

    Thanks for the reply. Yes... I think I probably thought that at first too! But apparently not....

    And yes, you can get rejected... I'm pretty sure Apple identify such behaviour as meriting a rejection, and Amazon's US App store for Android apps reviews each app and require this area to work correctly. On phones the ability to be able to manage incoming calls without any interruption is treated pretty seriously. That even means that apps which can in any way cause the phone to actually hang could cause a rejection.

    But... I think a fix should be straightforward. The PhoneGap docs provide the details of the event handlers and it is simply a matter of using them, pausing all action and muting all the sound.

    Thanks! :-)

  • P.S. Not sure if you'll need to look into something similar for AppMobi export too......?

  • Go2Holidays yep will fix this for appMobi too.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Windows Phone have a tombstoning process where all state is saved to disk. Then it would be restored with the game paused. Like a load/save game.

    Not sure if this is possible to support generically?

  • Ashley

    Hey Ashley, thanks for getting r85 out so quickly and for dealing with these issues.... :-)

    However.... can I confirm whether the audio is being properly suspended on Android when you switch out of the game to another application (or phone call, or home screen)....? I did a test on the Android Simulator using a PhoneGap built game exported from r85 and when I click the home button (to display phone's main home page) the action does indeed seem to pause (as it appears to be at the same place when I return to the game), but the audio just carried on playing....?

    The game has a main music track playing, with various sound effects being played as things happen. Obviously the sound effects stop as the action has stopped to keep generating them.... but the music kept playing.

    :-(

    Any ideas?

    Thanks!

  • Go2Holidays, are you using appMobi or PhoneGap?

  • Ashley

    PhoneGap (mentioned in message above ;-) )

  • That's odd, I'll try another test soon...

  • Ashley

    Did you discover any more with this? Does it work fine on Android for you?

    Thanks!

  • I`m getting the same problem with Android (2.3 / 4) and Phonegap (2.3 / 2.5).

    Anybody got a solution? Thanks!

  • Hi everyone,

    Ashley, first off, thank you for C2! enjoying it very much.

    has this issue been resolved? would like to know how.

    thanks

    =)

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