cyberwombat
cyberwombat

Reputation: 40084

Sencha Touch 2 and phonegap - how to launch app

Anyone have sample code on how to launch a ST2 app from phonegap? I can only find ST1 tutorials and have not been able to make them work.

I have my working ST2 app with my code in app.js - I guess I need to use the ondeviceready event but not sure where to do so.

Thanks

Upvotes: 4

Views: 5825

Answers (5)

pashute
pashute

Reputation: 4053

Even if you don't need phonegap API its worth using Phonegap build:

a. Build your Sencha App with phonegap-build website. Its free, easy and great. see details below.

b. See Sencha Native API tutorial here. http://docs.sencha.com/touch/2-0/#!/guide/native_apis

Details

Use the Phonegap-Build free website. Its fantastic.

a. Use it if you need phonegap specific functionality -- AFAIK Sencha Native is missing contacts - please correct me if I'm wrong.

b. Use it because you want the fantastic phonegap-build free online utility, that gives you immediate compiled code for iphone, Android, Windows mobile, blackberry(!) and more.

How to compile you Sencha app on Phonegap-build

a. You REMOVE the phonegap.js (or cordova-xxx.js file) from the folders.

b. You must have a ref to the phonegap in your app.html. If its there, leave it. If not add the following line after the link to the css.

    <script type="text/javascript" id="phonegap" src="cordova-1.7.0.js"></script>

c. You copy the app.html to a new index.html file (I didn't try RENAME rather than COPY but it probably will work too)

d. And upload the credentials from apple developer - which you can create from a PC using open SSL.

e. You zip your directory, and in the phonegap-build site Edit and upload this zip.

The compiled Sencha code works on all the devices (iphone, android, blackberry touch etc)!

enjoy

Upvotes: 4

Michael
Michael

Reputation: 33297

I have the same problem how does native packaging to iPhone works with sencha touch 2. This tutorial does not answer my question: http://www.sencha.com/blog/sencha-touch-2-rc-native-packaging/

Upvotes: 1

Alex
Alex

Reputation: 1

As far I I know, Sencha Touch 2 doesn't use the ondeviceready function anymore, old tutorials aren't that much useful now. I suggest you following this tutorial to get your first steps on sencha/phonegap MVC programming.

http://miamicoder.com/2012/how-to-create-a-sencha-touch-2-app-part-1/

Upvotes: -1

Andrew Duncan
Andrew Duncan

Reputation: 321

I found the easiest option was to build the app into the www directory of your Xcode project using the Sencha Touch SDK.

The command I'm using is:

sencha app build production

You can change the output directory of your production build within your app.json.

The guide in the ST2 docs is pretty good: http://docs.sencha.com/touch/2-0/#!/guide/command

Don't forget to include Phonegap in your newly built index.html file:

<script type="text/javascript" charset="utf-8" src="cordova-1.5.0.js"></script>

You don't need to do anything special with phonegap to get it to launch. If it runs in chrome then it shouldn't be a problem on the device either.

Upvotes: 2

Titouan de Bailleul
Titouan de Bailleul

Reputation: 12949

As they are releasing ST2 RC, here you can find Sencha-Touch 2 Application examples

http://www.sencha.com/blog/sencha-touch-2-rc-native-packaging/

Upvotes: 0

Related Questions