-
13 Sep 2012 7:08 AM #1
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
-
16 Sep 2012 4:13 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
- Answers
- 3160
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
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
22 Oct 2012 3:24 AM #3
I have exactly the same issue with Cordova 2.1.0 and Sencha Touch 2.
Here's my code:
Trying to build application (sencha app build production) results in the following error:Code:Ext.application({ launch: function() { navigator.geolocation.watchPosition(function () {}, function () {}); } });
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.Code:...[ERROR] TypeError: 'undefined' is not an object
-
22 Oct 2012 4:32 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
- Answers
- 3160
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
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
22 Oct 2012 4:51 AM #5
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.
-
22 Oct 2012 7:41 AM #6
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.


Reply With Quote