Phonegap / AppMobi pros and cons

0 favourites
  •     var myaudio = new Media("/android_asset/www/media/someSound.ogg");
        myaudio.play();

    using call javascript plugin? :)

  • Essentially.... the code which CS creates lacks that /android_assett/www/ part, so it won't find the files (will look on SD card instead).

    This article pointed that out:

    simonmacdonald.blogspot.com/2011/05/using-media-class-in-phonegap.html

    So I did...

    1. in the c2runtime.js file I found the new Media() call and made it thus:

    case API_PHONEGAP:

    this.instanceObject = new Media("/android_asset/www/" + buffer_.src);

    break;

    2. I also set the default api to be API_PHONEGAP (because on my tests it didn't detect properly)... so:

    var API_HTML5 = 0;

    var API_WEBAUDIO = 1;

    var API_PHONEGAP = 2;

    var API_APPMOBI = 3;

    var api = API_PHONEGAP;

    3. I made the hasEnded() function return true for PhoneGap (as it wasn't working in my trial)...

    So...

    C2AudioInstance.prototype.hasEnded = function ()

    {

    switch (this.myapi) {

    case API_HTML5:

    return this.instanceObject.ended;

    case API_WEBAUDIO:

    if (!this.fresh && !this.stopped && this.instanceObject["loop"])

    return false;

    return (audRuntime.kahanTime.sum - this.startTime) > this.buffer.bufferObject["duration"];

    case API_PHONEGAP:

    return true; //(audRuntime.kahanTime.sum - this.startTime) > this.buffer.bufferObject.getDuration();

    case API_APPMOBI:

    true;     // recycling an AppMobi sound does not matter because it will just do another throwaway playSound

    }

    4. And in this call, I added the test for phonegap to prevent it doing the usual action:

    instanceProto.tick = function ()

    {

    var i, len, a;

    for (i = 0, len = audioInstances.length; i < len; i++)

    {

    a = audioInstances;

    if (a.myapi !== API_HTML5 && a.myapi !== API_APPMOBI

         && a.myapi != API_PHONEGAP)

    // PHONEGAP bit added above...

    {

    if (!a.fresh && !a.stopped && a.hasEnded())

    {

    a.stopped = true;

    audTag = a.tag;

    audRuntime.trigger(cr.plugins_.Audio.prototype.cnds.OnEnded, audInst);

    }

    ....I also (I should add) made the audio files be mp3s (for my test) and searched and replaced the references to .ogg and .m4a to be .mp3

    This was all done in the NON-minified JS..... and all seems to work fine when built as an Android APK via PhoneGap.

    If others (eg. ranma) have already got this working, then that's great, but it wasn't working for me (and perhaps not for others) and this is what it took to fix it. So hopefully that's of help to someone. :-)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ...interesting, I'll have a go at implementing this tonight, fingers crossed!

    Due to the sound issues, I'm reluctantly using AppMobi at the moment, but don't like the way they lock me into releasing apps as 3.4.0. I can't use my own signing keys either, which is a pain.

    Also, with PhoneGap I can decompile the apk and monkey around with the manifest file (and other files) then recompile with no problems. Can't seem to do the same with AppMobi.

  • Go2Holidays - I think I've managed to fix audio in PhoneGap for the next build. Note that android_asset is specific to Android so it will break iOS, I've added an Android-specific check in my version. Also the Audio object has a pretty complicated caching/audio recycling engine which your code does not take in to account, I'd recommend waiting for the next build where it should work!

  • Kickass!

  • Go2Holidays - I think I've managed to fix audio in PhoneGap for the next build. Note that android_asset is specific to Android so it will break iOS, I've added an Android-specific check in my version. Also the Audio object has a pretty complicated caching/audio recycling engine which your code does not take in to account, I'd recommend waiting for the next build where it should work!

    Fantastic Ashley - sounds great. <img src="smileys/smiley4.gif" border="0" align="middle" />

    I was aware that my code was Android only (would have suggested a check for system for anyone else), and realised it might not 'handle everything', but I was simply attempting to make the CS code do what I needed. For now, it seems to work.....

    ....when you get it in the next build... well, problem solved!

    Good work.

  • BTW... Call me Ian.

  • On topic, regarding the permissions on Android (PhoneGap vs AppMobi).

    On PhoneGap, if you add the "permissions=none" to the config file (which IIRC is the default when exporting now), then although the developer page on android market says that your users will be warned about 3 or 4 permissions, actually I found that when I installed my app on my phone through the market I was only prompted about 1 permission, which was "Full internet access" (which is something most ad-supported free apps have anyway so it won't shock the users). Compare that to the access of contacts data and such.

    You actually do get prompted about 3-4 permissions IF you have the APK and install it directly, but if you do it through the market, it's only 1 permission prompt.

  • Is AppMobi the right direction to go?

    I'm asking this cause I tried to play with this cool environment and somehow I got this notion out of the creators of AppMobi - These people are hungry for money.

    Don't get me wrong, every person who creates something which serves others needs to be able earn from his hard work, but in this case I got the feeling they plan to make impossible demands in this area.

    I could be wrong but in the past I was right in many cases so I wanted to share this feeling with you just as a warning sign.

    My fear is that they will do something like:

    • $50 per year for DirectCanvas
    • $49.95 if you want to play more than 2 sounds
    • $40 for speeding up things with the new something
    • $20.43 if you wish to get GeoLocation

    I don't want to offend anyone but this is a personal feeling I got while working with this cool environment. Am I wrong? I really hope so.

    It would be a shame for all of us if we'll reach cool results with C2/AppMobi only to find out it leads to unreasonable prices just for creating an app or two for the iOS market.

    Add to this the yearly $99 apple asks and you have a path which 99% of the people here won't allow themselves to walk in.

  • I really should check these forums more often :D

    There seems to be a couple misconceptions about appMobi I'll try to clear up.

    ranma

    I didn't but there's nothing to fix. It seems that they had users control over app version until they released Live Update, problem is that live update is a paid service, and apple doesn't seem to like it. I aggree that this is ridiculous.

    Our version number on Android was not a premeditated thought of world domination :D, just an oversight. We are working on a fix for this.

    LiveUpdates is completely compliant with Apple's terms of service as they allow OTA java-script updates on any app as long as the main theme of the app or game doesn't change. So as long as you don't change your game 100% through a live update, no Apple laws broken :D

    Our default permissions are implemented for beginner to mid-level developers as they are our main clients. We were running into many apps being denied because our users didn't understand which permissions to select. These aren't set in stone and we may change how we implement this in the future.

    We also understand that our pricing model is confused by many. We are redesigning it to be even friendlier to our developers (along with giving them WAY easier ways to monetize their game/app).

    PhoneGap is great software, but the learning curve is high. appMobi is geared towards furthering HTML5 and mobile development while making the whole process easier for developers. With our XDK, you can get started coding right away without having to worry about setting up your own IDE (which in PhoneGap, isn't a trivial task). We also created our own build system so that even novice developers can complete a build, without a Mac! Using our paid services isn't required for you to make a build and deploy, but they are always there for when you decide you want to add push messaging or payments into your game/app.

    I hope this clears some things up, and if you have any questions on appMobi you can post a thread here on our forums: forums.appmobi.com

    Cheers!

  • I really should check these forums more often :D

    There seems to be a couple misconceptions about appMobi I'll try to clear up.

    I don't think the "current status of things that in future are going to be changed" can be defined by "misconception" :) don't get me wrong and no offence, but from the start I was talking about how phonegap differs from appmobi NOW, not in future.

    Our default permissions are implemented for beginner to mid-level developers as they are our main clients. We were running into many apps being denied because our users didn't understand which permissions to select. These aren't set in stone and we may change how we implement this in the future.

    well this would be a good idea as accessing contacts without any reason doesn't look good, it's currently loud about android's autocad wanting access to phonebook :)

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