July 21, 2016

PhoneGap developement on Debian Linux

A friend of mine started a colloboration to create an App which aims to help Orphanage discovery. The main tool to use is PhoneGap. Little that I know, PhoneGap Desktop is not yet supported on Linux. The wine-ported version reported crashing upon launched.

The thing is, I didn't know that PhoneGap has command line tool called PhoneGap CLI. PhoneGap CLI is actually older than the Phone Gap desktop. I have used PhoneGap desktop on Windows before and I found it quite easy to use. I didn't do much with it though. Now that I am on full-time Linux, I will need to use the PhoneGap CLI, thus tutorial below is for those who are interested to develop a PhoneGap app using PhoneGap CLI.


1. First, install Node.js
sudo apt-get update
sudo apt-get install nodejs

2. Simlink Node.js as node (this is how PhoneGap calls it - node instead of nodejs)
sudo ln -s /usr/bin/nodejs /usr/bin/node

3. Install NPM - this is package manager for PhoneGap and other similar javascript programs
sudo apt-get install npm

4. Install PhoneGap using NPM
sudo npm install -g phonegap

5. Install the PhoneGap Developer App from Google Play
https://play.google.com/store/apps/details?id=com.adobe.phonegap.app&hl=en

To get started, lets create hello world app

# create a PhoneGap project, NPM will pull simple hello world project for us to use
phonegap create myApp
# change to project directory 
cd myApp
# build and install the app to Android               
phonegap run android
# start up a local web server to host our application      
phonegap serve           

Get the ip provided and put it in the PhoneGap Developer App on your phone.
The first page displayed is stored at YourAppDirectory/www/index.html

That's it. You're good to go!

To learn what's there in hello world page, go to here :
http://docs.phonegap.com/tutorials/develop/hello-world-explained/




Some screenshots :