1. #1
    Sencha User
    Join Date
    Sep 2012
    Posts
    1
    Vote Rating
    0
    eilonf is on a distinguished road

      0  

    Default Unanswered: Sencha Touch 2 and Cordova 1.7.0

    Unanswered: Sencha Touch 2 and Cordova 1.7.0


    Hi All,

    I am trying to get ST2 and Cordova 1.7.0 to work together.

    I followed the tutorial at
    http://robertdougan.com/posts/packag...onegap-cordova
    and got it working.

    Now I need to call a Cordova plugin before I show the Main view, but I Sencha does not
    build my app when calling the plugin (sencha app build package fails with TypeError: 'undefined' is not an object).

    I found out that if I wrap the call to the plugin with a setTimeout, the build works ok, but its not a very good solution.

    How do I call the navigator.xxxx.xxxx.xxx API's without breaking ST?

    Thanks,

    Eilon

    Edit:
    I know that I need to call the plugins from the "onDeviceReady" event of ST. How do I do that correctly?

    Thanks

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,784
    Answers
    3465
    Vote Rating
    833
    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


    The launch method of Ext.application will fire only after all ST classes, <body> reports loaded and when within cordova/phonegap the deviceready event fires.
    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
    Oct 2012
    Location
    Poland
    Posts
    70
    Answers
    4
    Vote Rating
    5
    szimek is on a distinguished road

      0  

    Default


    I have exactly the same issue with Cordova 2.1.0 and Sencha Touch 2.

    Here's my code:
    Code:
    Ext.application({
        launch: function() {
            navigator.geolocation.watchPosition(function () {}, function () {});
        }
    
    });
    Trying to build application (sencha app build production) results in the following error:
    Code:
    ...[ERROR] TypeError: 'undefined' is not an object
    I tried loading cordova-2.1.0.js in app.json before sencha-touch.js and my app.js files and I tried loading it in index.html file, but I'm still getting this error.

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,784
    Answers
    3465
    Vote Rating
    833
    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


    You're getting that because the builder isn't within cordova so navigator.geolocation.watchPosition is not valid
    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.

  5. #5
    Sencha User
    Join Date
    Oct 2012
    Location
    Poland
    Posts
    70
    Answers
    4
    Vote Rating
    5
    szimek is on a distinguished road

      0  

    Default


    I don't really understand Is there a way to fix it? Currently I'm providing dummy navigator.geolocation object with empty functions to make builder work.

  6. #6
    Sencha User
    Join Date
    Jan 2012
    Location
    London, UK
    Posts
    498
    Answers
    25
    Vote Rating
    51
    shepsii has a spectacular aura about shepsii has a spectacular aura about shepsii has a spectacular aura about

      0  

    Default


    I've come across similar gripes... I wish there was a way to build a package of a sencha app without validating all the code! I understand why it's necessary though, it's just annoying. szimek's solution is similar to what I had to do.

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