O2-slate-02-lg

For those in meddling mode then this is for you.  This all started from a call from a good friend in need of a little help on a PhoneGap project. So as an evening thing to help him I said no problem.

PhoneGap is an open source framework for development mobile applications. It essentially puts the bridge between web development and mobile development.  On the whole it works well. 

Though PhoneGap is now a top level Apache project, Apache Cordova, I’ll refer to it as PhoneGap

1. Prepare the device.
So in this instance it’s a basic Kindle Fire, no HD. Once the device has ADB enabled (in the settings > device menu) you will need to amend the adb_usb.ini file to enable the USB of the device.  Not got a Kindle Fire? Want one? Click here to order one??? 

In Mac OSX the .ini file is in your home directory:
~/.android/adb_usb.ini

And you need to add the following two lines:
0x1949
0x0006

[Warning! Make sure there are no blank lines underneath the last line]

2. Create a PhoneGap Project

If you haven’t downloaded PhoneGap then you can do so from http://phonegap.com (I’m assuming you already have the Android SDK installed). Once it’s installed go to the /lib/android/bin directory and you’ll see the create scripts.

Each project needs a working directory, a package name and a project name.  So???.

./create ~/MyPhoneGapApp com.jasebell.phonegap.testproj MyPhoneGapApp

Go to the directory you specified when you ran the create script.

You’ll see a build.xml file which means that we can use the Ant Built Tool from the command line to build and package our debug/release versions of our application. No need to huge amounts of Eclipse or IntelliJ though these are great IDE’s. 

3. Go unleash your design genius.

(This isn’t my department, I’ll wait here until you come back???.)

4. Build the debug version

From the command line (assuming you have Ant installed) you can just go:
ant debug

And the build script will do all the work compiling and packaging the application. Your packaged (and temporary signed) debug application is in the bin directory.

-rw-r–r–  1 Jason  staff  2010386 22 Nov 23:00 MyPhoneGapApp-debug.apk

5. Installing the apk on to the Kindle Fire

Nearly there??? first check the device is showing up via adb.

Jason-Bells-MacBook-Pro:bin Jason$ adb devices
List of devices attached 
D026A0A0241700TM
device

That’s our Kindle Fire there.

To install the .apk file we use adb again.

Jason-Bells-MacBook-Pro:bin Jason$ adb install MyPhoneGapApp-debug.apk 
5520 KB/s (2010386 bytes in 0.355s)

pkg: /data/local/tmp/MyPhoneGapApp-debug.apk
Success

If you open the device and go to the Apps folder you’ll see your app at the top all being well.  If all worked okay you will see the default screen. Ensure that it does say “Device Ready” this means that the script libraries have initialised okay.

Photo

Advertisements