Friday 20 September 2013

Installing PhoneGap

Hello Dear,
This tutorial covers only the installation of phonegap on your system and not any of the platforms, like android or iOS. It is so because I chose to compile my app online at build.phonegap.com. And if you have no idea about what phonegap is, please read the overview here.
And hey, if you didn't know, you can create your phonegap app without even installing any of the frameworks. This is really fun where you don't have to worry about installing any of the SDKs. You simply create your code and upload it over build.phonegap.com. They then compile your code and return you back the installer file for the intended mobile. The fun part is, you can have installer for any of the platforms (android, ios, symbian,etc.) by simply updating a single code and even without having downloaded any of the needed SDKs. For me, this was very relieving. You can go the other way too, but that's your choice.
The need to install phonegap is that, if you don't install phonegap, you won't know the structure of the directories and files that you may need to create your mobile app. Also, installation of phonegap requires NodeJS. If you're smart enough, you can go for the procedure over here. Other wise, the crunch comes following:



Installing Phonegap:
1.     Download NodeJS (.msi) file from its website (here). The webpage allows you to download it for whatever operating system you're using (Mac, Windows).
2.    Once downloaded, install it using the installer (execute the .exe file of NodeJS)
3.     Open cmd (goto start and type cmd, or you can find it in Start->Programs->Accessories->Command prompt), type npm install -g phonegap
4.     It’ll take a while to download phonegap from registry.npmjs.org
5.     Once installation completes, you can invoke phonegap in cmd for further help by typing ‘phonegap’ (without qoutes)
 
Creating your first mobile app:
1.     Type phonegap in cmd after installation of phonegap
2.     Now, type create my-app. It’ll create a new app named my-app. If the www plugin would be missing, it’ll first install the plugin through download (obviously, you need an active internet connection). Once done, it’ll display created project at c:\users\user\my-app
3.     Now, type cd my-app (change the current directory to project directory)
4.     Now, type phonegap run android. It’ll ask for your GitHub username (if you don’t have a github username, signup for one at github.org)
5.     It’ll ask for your password then. The password will not show in cmd, yet it’ll be typed. So type your password properly.
6.     Once logged in successfully, your app will be zipped and will be sent to github.
7.     On successful compilation at github, it’ll send you back the QR code of the app. You can scan this code with your smartphone and it’ll be installed on your phone through internet.
8.     Enjoy, you first app is done!

In case I've been wrong any where, please correct me by commenting down. I always appreciate that.

No comments:

Post a Comment