1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    26
    Answers
    1
    Vote Rating
    1
    matdar is on a distinguished road

      0  

    Default Unanswered: How to Trap DeviceReady Event using Cordova .7 and a Command Generated MVC app

    Unanswered: How to Trap DeviceReady Event using Cordova .7 and a Command Generated MVC app


    I've found that openDatabase returns null on an Android emulator (it's ok on iOS simulator) so I've reasoned I need to run with PhoneGap (is there a non Phonegap way around that problem?).

    I'm using the 2.0.1 ST and Cordova 1.7. My app has been generated using the sencha command tool so I don't want to change index.html to include Cordova (which rules out the bear bones example).

    So I've added the script using:

    Code:
    "js": [
            
            {
                "path": "sdk/sencha-touch.js"
            },
            {
    
    
                "path": "cordova-1.7.0.js",
                "update": "delta"
    
    
            },
            {
                "path": "app.js",
                "bundle": true, 
                "update": "delta"
            }
        ],
    Do I need to trap a deviceready event form PhoneGap? If so how and where do I do that?

    Thanks

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,756
    Answers
    3462
    Vote Rating
    828
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Why do you need to trap the deviceready event? The launch method of Ext.application should fire when the deviceready event has fired and all the required ST2 classes have been loaded so you shouldn't need to mess with the deviceready event.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    23
    Vote Rating
    5
    jamezilla is on a distinguished road

      0  

    Default package build

    package build


    Just in case Mitchell didn't answer your question, are you running a package build in Cordova?

    Code:
    sencha app build package
    You need to run a package build in order to make the app standalone. This will make sure the microloader does the right thing when the app fires up. As Mitchell tersely mentioned, the launch even listens for the deviceready event, so you shouldn't need to do anything else to index.html to make it all work.

    My app.json file is similar, but I've got cordova.js first, and no "update":"delta" - just the path. I'm not sure what having the delta update config in there would do, but since you're probably never generating deltas on the cordova script it shouldn't be in there.

  4. #4
    Sencha User
    Join Date
    Sep 2011
    Posts
    26
    Answers
    1
    Vote Rating
    1
    matdar is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    Why do you need to trap the deviceready event? The launch method of Ext.application should fire when the deviceready event has fired and all the required ST2 classes have been loaded so you shouldn't need to mess with the deviceready event.
    In another thread I just saw (http://www.sencha.com/forum/showthre...ng-the-MVC-app) you said :

    onReady will fire when the HTML document says it is ready (along with the required classes loaded if still using dynamic loading of classes). However, PhoneGap's deviceready event is separate and will fire when PhoneGap is all initialized with any plugins and such. That's why you have to add a listener for the device ready. Basically, when both are fired, then the application/device is ready.
    I wanted to trap the deviceready so that I know Cordova has loaded (because I want to use its openDatabase). Is there another way to know Cordova's initialised?

    Thanks

  5. #5
    Sencha User
    Join Date
    Sep 2011
    Posts
    26
    Answers
    1
    Vote Rating
    1
    matdar is on a distinguished road

      0  

    Default


    Quote Originally Posted by jamezilla View Post
    Just in case Mitchell didn't answer your question, are you running a package build in Cordova?

    Code:
    sencha app build package
    You need to run a package build in order to make the app standalone. This will make sure the microloader does the right thing when the app fires up. As Mitchell tersely mentioned, the launch even listens for the deviceready event, so you shouldn't need to do anything else to index.html to make it all work.

    My app.json file is similar, but I've got cordova.js first, and no "update":"delta" - just the path. I'm not sure what having the delta update config in there would do, but since you're probably never generating deltas on the cordova script it shouldn't be in there.
    Thanks for that, I appreciate the help!

    - I was running

    Code:
    sencha app build native
    How do I go from a standalone packaged build (sencha app build package) to a deployable app that I can run on the iOS/Android simulator and then deploy to the store?

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