Combining Sencha Touch with PhoneGap is a great option, as it allows access to a lot more device functionality that would otherwise be restricted whilst still allowing you full use of the features Sencha Touch offers. By default, Sencha Touch already has great support for PhoneGap as these two technologies are commonly used together. There are two ways to go about including PhoneGap in your application: there's the 'normal' way and the 'easy' way, we will be focusing on the latter in this article by taking a look at how to use PhoneGap Build
**UPDATE: **The way in which you should include PhoneGap Build in your Sencha Touch projects has changed. This article still contains relevant information about PhoneGap Build but you should take a look at Building Your App Remotely with PhoneGap Build and Sencha Cmd for instructions on how to implement it.
PhoneGap Build is a cloud based service offered by Adobe that takes away the hassle of creating and maintaining your own PhoneGap project. PhoneGap Build allows you to simply upload your web files and all of the compilation is completed on their end and then returned to you. There are benefits to using this method such as the fact that you don't need to maintain multiple SDKs on your computer and being able to create an iOS PhoneGap application without a Mac. There are some trade-offs however, PhoneGap Build often lags behind with updates to PhoneGap and does not offer all of the functionality that PhoneGap does.
UPDATE: I've added a video tutorial on setting up PhoneGap Build, you can check it out here.
To get started with PhoneGap you can head over to https://build.phonegap.com/ and register your account. You will notice that there is both a free and a paid option; you are able to create one private application for free but you need to pay for more than that. If you want your application to be open to the public, then you are able to create more apps. This does not mean that you can only create one application ever for free, you can continue using the same account and simply delete an old application and replace it. If you want to have multiple projects running at once though then you'll most likely have to part with some cash.
Once you've logged in and created an app on PhoneGap Build, you will see an option to upload your code and all of the platforms that it will be built for, these are:
- Windows Phone
By default, your application will be built for every platform but this can be changed in the config file if you wish.
Using PhoneGap Build is almost as easy as just uploading your code, but there's a couple other steps you need to take first. In Sencha Touch you'll have to open up your index.html file and add the following line:
You should take a look at the documentation to get a better understanding of what can be defined in this file.You will also need to create the appropriate certificates, you can check out how to create an iOS provisioning profile and .p12 with Windows here. Once you've got these things in order, you should be able to upload your code by zipping up the entire project folder and have your army of native applications delivered right back to you.
Future posts will cover this topic in more detail, let me know in the comments if there is anything specific you'd like me to focus on!