1. #1
    Sencha Premium Member
    Join Date
    Mar 2012
    Posts
    39
    Vote Rating
    0
    shanlin is on a distinguished road

      0  

    Default Unanswered: Ext.setup has already been called before when using Phonegap 1.5 on Android

    Unanswered: Ext.setup has already been called before when using Phonegap 1.5 on Android


    I am using Sencha touch 2 and Phonegap 1.5, and try to package and deploy to Android 2.2. I got this error:
    Ext.setup has already been called before.

    I use sencha-touch-debug.js and have a block of code in app.js like:
    Ext.setup({
    ...
    onReady: function() {...}
    });

    Could anyone shed some lights on what is causing this?

  2. #2
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,353
    Answers
    102
    Vote Rating
    79
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    I would call your ST code within onDeviceReady();



    That said, you should not be using Ext.setup, rather Ext.application();

  3. #3
    Sencha Premium Member
    Join Date
    Mar 2012
    Posts
    39
    Vote Rating
    0
    shanlin is on a distinguished road

      0  

    Default


    Could you elaborate on where does onDeviceReady() reside? Could you post some sample codes?

  4. #4
    Sencha User
    Join Date
    Jan 2008
    Location
    Toronto, Canada
    Posts
    480
    Vote Rating
    4
    elishnevsky is on a distinguished road

      0  

    Default


    Here's a good starting point for you:

    http://www.sencha.com/learn/a-sencha...-with-phonegap

  5. #5
    Sencha Premium Member
    Join Date
    Mar 2012
    Posts
    39
    Vote Rating
    0
    shanlin is on a distinguished road

      0  

    Default


    My app.js used Ext.application ({...}); initially without phonegap in the picture. Since I need to package phonegap to take advantage of their support of native API, I refered to the article you mentioned to integrate. I used
    document.addEventListener(ondeviceready, app.mainLaunch, false). But it complains that cannot find "app" object.
    Then I read an article which suggests use Ext.setup ({ onReady: function() {...}) to wrap around Ext.application({...}).
    That is the history of my taking the route of using Ext.setup.

    If use your suggestion, how do I get around the issue of "cannot find 'app' object" when in index.html I use document.addEventListener(ondeviceready, app.mainLaunch, false) ?

    Many thanks for the help and be patient, I am new to this space.

  6. #6
    Sencha User
    Join Date
    Jan 2008
    Location
    Toronto, Canada
    Posts
    480
    Vote Rating
    4
    elishnevsky is on a distinguished road

      0  

    Default


    Is 'app' the actual name of your application? Hmm... Anyways, you app object doesn't exist at this point yet. Call it like this:

    Code:
    document.addEventListener("deviceready", function () {
        app.mainLaunch();
    }, false);

  7. #7
    Sencha Premium Member
    Join Date
    Mar 2012
    Posts
    39
    Vote Rating
    0
    shanlin is on a distinguished road

      0  

    Default


    I finally follow this thread and make it work:
    http://www.sencha.com/forum/showthre...=ondeviceready

    In general, here are the keys that save me:
    (1) For PhoneGap 1.5 and ST 2.0, there is no need for setting up ondeviceready or onready events. ST2.0 handles it nicely when using 'Ext.application({...}).
    (2) in index.html, phonegap js needs to be at the top.
    (3) use sencha-touch-all.js instead of using others.

    Thanks for all the helps and suggestions!

  8. #8
    Sencha User
    Join Date
    Jan 2008
    Location
    Toronto, Canada
    Posts
    480
    Vote Rating
    4
    elishnevsky is on a distinguished road

      0  

    Default


    Oh, wow... I did not know that. Thanks!

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi