Phonegap Tutorial for a busy programmer
As the title says, lets get to it right away
As they say, “Building applications for each platform–iPhone, Android, Windows and more–requires different frameworks and languages. PhoneGap solves this by using standards-based web technologies to bridge web applications and mobile devices.”
Note
This tutorial is for Android till now. iOS codes will be updated as soon as you gift me an iPhone :P
Prerequisites
- NodeJS >= 4.x
- npm >= 3.x
- A good text editor (hint: Sublime)
- Chrome (works best)
- Basic Terminal Commands (cd, ls, etc.)
- Android SDK
- JDK >= 7
- Ant (optional)
Setting up Environment
- Install NodeJS
- Update NPM ( node Package Manager)
a. Mac :npm install -g npm
b: Others:npm update -g npm
- Install Sublime Text Editor or Atom
- Install Android SDK
You don't need Android Studio but it eases a lot of stuff
- Install JDK
- Make Sure JAVA environment variables and ANT is properly set in windows and Mac
- Reboot PC (optional)
- npm install -g phonegap // install phonegap globally
First ‘Hello World’
- In Terminal, create a new directory for your projects
mkdir phonegapApps && cd phonegapApps
- Scaffold phonegap app :
phonegap create helloworld
. This will download dependencies as well. - Open index.html and change something (e.g. your name in a new div). Save and close.
- Try viewing it :
phonegap serve
. Open the link in your mobile or browser. - Keep changing stuff and refresh the page, till you are happy.
- Change ‘config.xml’ with your name and other details
- Add Android Platform to your project
cordova platform add android --save
(phonegap is just Adobe’s version but basically its just the SAME) - Build the damn thing
phonegap build android
- Transfer the debug apk from
.\platforms\android\build\outputs\apk\
to your phone via Airdroid or USB - Change your security settings in phone to allow installing apps outside Google Play.
- Enjoy!
Signing for Production
- Make sure your bundle IDentifier is properly set ‘com.company.productname’
- Make Sure proper icons are settled
- Sign in via keytool (java) :
keytool -genkey -v -keystore my_keystore.keystore -alias TutorialsPoint -keyalg RSA -keysize 2048 -validity 10000
- More guidelines will be coming up.
But why though?
A firend of mine (yes, its you bittu) needed a quick cheat sheet for phonegap as he is very busy with his work. So hence, this is it.
Bump
A full tutorial on making a chat app in phonegap will be uploaded in near future that will use Socket.IO, Phone Number Verification and end-to-end encryption using signal server.