0
votes

I'm wondering how I can integrate Sencha Touch projects into a Cordova project.

I know that with current Sencha Cmd we can generate a Cordova project from the Sencha code, but the code is compressed and not flexible for changes. (For example, the official Facebook sdk does not work any more after this build, I will have to work with the Cordova-facebook-plugin).

So I created a new Cordova project, and as a beginning, I created a new helloWorld sencha touch app. I removed the original stuff in the www/ folder of the Cordova project and put everything of this Sencha Touch project under it, but the loading was not successful.

I found this post and realized some extra configurations are needed, but this post seems out-of-date for me.

Any help will be greatly appreciated!

2

2 Answers

0
votes

Create a sencha touch project and cordova project seperately.

Add the required platform inside your cordova project.This will give you the required platform specific cordova.js file.

Now take the cordova.js file and paste it under the app folder of your sencha project.

Open the app.json file and add mapping to the file like this

'Js' : [

{

    'Path' : 'touch / sencha-touch.js' ,

    'X-bootstrap' : true

}

{

   'Path' : 'cordova.js' ,

    'X-bootstrap' : true

}

{

    'Path' : 'app.js' ,

    'Bundle' : true ,

    'Update' : 'delta'

}

]

Now you can check in Chrome Developer Tools that cordova.js is included in the project.

Now load your app only after cordova is loaded by including the following function in your app.js file

launch: function () {

/ / Destroy the # appLoadingIndicator element

Ext.fly ( 'appLoadingIndicator' ). destroy ();


/ / Wait for cord to be ready

document.addEventListener ( 'deviceready' , function () {


     Ext.Viewport.add (Ext.create ( 'MyApp.view.Main' ));


}, false );

}

You can no longer run the project in browser beacuse cordova is include.Use a phone to see your project as an app

Here is the link to detailed tutorial that helped me with my project

http://senchadevelopers.blogspot.in/2013/09/integrating-phonegap-with-sencha-touch.html

0
votes

Try the following.

  1. integrate with phonegap details here
  2. in your build.xml add the following
<target name="-before-init">
 <property name="build.options.production.debug" value="debug:true"/>
</target>

then run sencha app build native. This might get you an uncompressed version in your phonegap folder.