Phonegap / AppMobi pros and cons

0 favourites
  • why? :D

    Because, as you said, the base Media() is buggy.

  • > why? :D


    Because, as you said, the base Media() is buggy.

    I didn't :) I said the construct's audio object doesn't work with phonegap, that's all. I didn't run into any problems with phonegap base media object, not that I had it put to the extreme tests or something. Anyhow, thanks for pointing out that there's plugin for the audio output, when I have problems with base media object, will use the plugin of course :)


  • Pode, PhoneGap Build doesn't support plugins, so using any of those prevents anyone from being able to build their game on PhoneGap Build. Then you gotta install hundreds of megabytes of dev software to build instead. PhoneGap Build say they'll support plugins in future so I was going to wait for that.

  • Ashley : okay. I was thinking about the people doing their own compilation with XCode :).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Pode, PhoneGap Build doesn't support plugins, so using any of those prevents anyone from being able to build their game on PhoneGap Build. Then you gotta install hundreds of megabytes of dev software to build instead.

    aggreed, but after that you can do lots of great things you never would do without it :) and testing your apps becomes so easy you wouldn't even imagine (i know I wouldn't if I didn't do it, its painful once, but after you install it... ghaad :) with a little bit of javascript you can do ftp file uploads / downloads, speech recognition, and everything that you can with phonegap plugins, so for me it actually was worth it :)

  • Hi Ashley,

    I'm new here, but I'd like to ask about the PhoneGap audio issues... you wrote:

    "I've tried, and failed, to get PhoneGap to play audio. It just doesn't support it AFAIK. AppMobi specifically provide an alternative way to play audio which I've plugged in to the Audio object, which is why it works. It would be nice if PhoneGap could play audio, but to be honest after a few months watching what they're doing and trying to prod them in to better supporting games, they just don't appear to be interested. I think they're more about supporting website-style apps. Their open source model also makes it hard to contact anyone in charge or get a clear status on what their plans are. I really like PhoneGap, but it's just not progressing fast enough. AppMobi are doing loads on the other hand, and things like playMobi look really good, which is why we're shifting focus - PhoneGap support is about as good as it can be right now."

    I've not had time to investigate in-depth the JS which CS generates, but I see it attempts to access the PhoneGap media object to play sound, if running via PhoneGap. It 'ought' to work.

    I did an experiment with a construct2 game I made. In the index.html page (which has the canvas on it) I added a standard HTML link to a test.html page. On that page I made some simple use of the PhoneGap media object (as described in PhoneGap's docs) to play some audio. I built this and deployed on the Android emulator on the PC. When run, the first page (the CS game) produced no audio.... but clicking the link to the test page then played the audio via PhoneGap's code just fine. So... the code CAN run in this app, it is just that the CS JS must be doing something a little out of kilter.

    Here's the code in that test.html file I linked to...(taken straight out of the PG docs)





            <title>Media Example</title>

            <script type="text/javascript" charset="utf-8" src="phonegap.js"></script>

            <script type="text/javascript" charset="utf-8">

                // Wait for PhoneGap to load


                document.addEventListener("deviceready", onDeviceReady, false);

                // PhoneGap is ready


                function onDeviceReady() {



                // Audio player


                var my_media = null;

                var mediaTimer = null;

                // Play audio


                function playAudio(src) {

                   if (my_media == null) {

                        // Create Media object from src

                        my_media = new Media(src, onSuccess, onError);

                   } // else play current audio

                   // Play audio


                   // Update my_media position every second

                   if (mediaTimer == null) {

                        mediaTimer = setInterval(function () {

                            // get my_media position


                            // success callback

                            function (position) {

                                if (position > -1) {

                                    setAudioPosition((position) + " sec");



                            // error callback

                            function (e) {

                                console.log("Error getting pos=" + e);

                                setAudioPosition("Error: " + e);



                        }, 1000);



                // Pause audio


                function pauseAudio() {

                   if (my_media) {




                // Stop audio


                function stopAudio() {

                   if (my_media) {




                   mediaTimer = null;


                // onSuccess Callback


                function onSuccess() {

                   console.log("playAudio():Audio Success");


                // onError Callback


                function onError(error) {

                   alert('code: ' + error.code + '\n' +

                      'message: ' + error.message + '\n');


                // Set audio position


                function setAudioPosition(position) {

                   document.getElementById('audio_position').innerHTML = position;





            <a href="#" class="btn large" onclick="playAudio('');">Play Audio</a>

            <a href="#" class="btn large" onclick="pauseAudio();">Pause Playing Audio</a>

            <a href="#" class="btn large" onclick="stopAudio();">Stop Playing Audio</a>

            <p id="audio_position"></p>



  • But.... obviously right now the PhoneGap audio via CS isn't working.

    So, if AppMobi is the only route, could I just ask for a simple run-down of what is needed to get a game built based on AppMobi?

    ie. I run CS.... and export to AppMobi. That gives me a folder of files on disk. What do I do next with that in order to build it into an Android or iOS package?

    (If the question sounds dim, it is simply because when I visit AppMobi's site I see a whole slew of different products and services, some open-source, some paid, and it's a bit confusing trying to work out which you need to simply take a CS game and get an Android package built based on AppMobi)

    Thanks for any help! :-)

  • Go2Holidays you need to download appmobi xdk and install it in chrome as plugin, then it's quite straight forward, you run it, you add application project, you paste c2 exported files, you refresh project, you build project.

  • Hi Ranma,

    Great - that's fantastic. I saw the XDK, but wasn't sure if that was one of the $99 a year for usage offerings. If it is simply a case of running in Chrome, and using it much as I'd use PhoneGap BUILD then I'll give it a go. Thanks! :-)

  • well that's the problem with appmobi, on every step you'll see $something :) want to update your app to a newer version? pay us $something a month! want payments in your app? pay us! :)

  • Hi,

    I've given AppMobi a whirl then... quite straightforward... although I did have one or two issues with it.

    But the main problem I noticed is that any calls to stop audio from CS seem to get ignored? This obviously may be an issue with CS, but I notice that whilst short sound simply play (and finish soon afterwards, so you have no real need to stop them), music just keeps on playing. It never stops! So when you go to another layout in your game which starts another music track, you simply have two tracks of music playing over the top of each other.

    Is this a known issue? Anyone else found that?


  • true, stop audio doesn't work.

    also i noticed lately some problems with audio in appmobi.

    now. back on topic? :D

  • Aha... well that explains that one then. Thanks. So... CS + PhoneGap = NO sound.... and CS + AppMobi = Unstoppable sound.

    Which is a good comparison of the relative pros and cons of PG and AM in that area then.... and as such, I don't think we are, or were, off topic, were we? ;-)

  • now we're not ;) also appmobi = not working editable text box plugin in C2 so no login of any kind can be created.

  • Good news... I managed to tweak CS2's JS to get it playing audio (multi channel) via PhoneGap on Android. I'll post again later (tonight maybe) with what I did, but hopefully it will be of help to others.

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

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