History:
| 01.jul.2009 |
: Initial
version for Ubuntu 9.04 and Android SDK 1.5 (Cupcake) |
| 16.sep.2009 |
: Upgraded
to Android SDK 1.6 (Donut) |
| 27.oct.2009 |
: Upgraded
this guide to Ubuntu 9.10 (Karmic Koala).
The older version for Ubuntu 9.04 (Jaunty) is here...
|
Developing
applications for the Google's Android phone
on Ubuntu 9.10
The
Eclipse
IDE and Ubuntu is a very powerful combination for professional
development work on the Android Phone.
This guide will
show you how to install the Eclipse IDE and Android Development
ToolKit on Ubuntu Linux.
You will also
learn how to create a basic Android application and run
it in the emulator.
This is your target.

Failure
is not an option here.
Pre-requirements
• Basic
knowledge of Unix/Linux would be nice. Study pocket
guide.pdf
•
You
should also know how to program in Java or similar languages. Study http://java.sun.com/tutorial
We are now going to install these programs
•
The Ubuntu Linux Desktop.
• Sun's Java Runtime (JRE) and Development Kit (JDK).
Java Runtime is only
needed to run the Eclipse IDE. Android has its own optimized Java VM
(Dalvik).
• The
Eclipse IDE.
• The Android
Software Developer's Kit (SDK).
• The Android
Developer Tool (ADT), a special Eclipse plugin.
---------
0)
Install Ubuntu Desktop
Start
by installing the lastest Desktop version of Ubuntu Linux. Follow this guide...
You
may either choose 32 or 64bit
Ubuntu. Both systems suit well.
Fulfill
all 10 steps ;-)
Ubuntu Linux has
become the #1 development
platform for Google's Android.
And Android itself runs on the Linux kernel too.
Many
benchmarks witness.. of Ubuntu's powerfulness and suitability for
this
task.
---------
1) Install Sun's official Java
Install
Sun's Java Runtime Engine (JRE) and Java Development Kit (JDK).
Also remove OpenJDK and other incompatible Java solutions.
Start
gnome-terminal from Ubuntu's main menu Applications
-> Accessories -> Terminal and run these
commands one by one (do not type the $).
$ sudo apt-get remove -y --purge openjdk-6-jre
openjdk-6-jre-lib openjdk-6-jdk gcj
$
sudo apt-get install
--reinstall -y sun-java6-jre sun-java6-jdk sun-java6-fonts
If
you need to confirm the license, press
TAB-key or arrow-keys to move the cursor in
the text
window.
---------
2) Download and install the latest Eclipse IDE
The
Ubuntu's
Eclipse package does not have all required features. Remove it !
$
sudo apt-get remove eclipse
We have to
download
the latest Eclipse IDE (named Galileo) from eclipse.org.
Browse to http://www.eclipse.org/downloads and download the "Eclipse
IDE for Java EE Developers (188 MB)"
Take either 32bit... or 64bit... Linux version
depending on your Ubuntu OS.
Type uname
-a
command if in doubt. It
should report i686 (for 32bit) or X86_64 (for 64bit Linux).
Extract the
tar.gz file to your $HOME folder.
See picture 2a.

It should
create an "eclipse" directory in your $HOME area (like
/home/username/eclipse/).
Then check the eclipse directory.
$ ls -l $HOME/eclipse/
drwxrwsr-x 2
moma moma 4096 2009-06-19 08:49 about_files
-rw-rw-r--
1 moma moma 14932 2009-06-11 21:59 about.html
-rw-rw-r--
1 moma moma 83657 2009-06-19 08:49 artifacts.xml
drwxrwsr-x
4 moma moma 4096 2009-06-19 08:49 configuration
drwxrwsr-x
2 moma moma 4096 2009-06-19 08:49 dropins
-rwxr-xr-x
1 moma moma 68333 2009-05-20 00:04 eclipse
<-- Eclipse executable.
-rw-rw-r--
1 moma moma 345 2009-06-19 08:49 eclipse.ini
-rw-rw-r--
1 moma moma 16536 2005-02-26 00:53 epl-v10.html
drwxrwsr-x 22
moma moma 4096 2009-06-19 08:49 features
-rw-rw-r--
1 moma moma 9022 2006-12-11 17:04 icon.xpm
-rwxr-xr-x
1 moma moma 335360 2006-12-11 17:04 libcairo-swt.so
-rw-rw-r--
1 moma moma 6506 2005-03-17 23:12 notice.html
drwxrwsr-x
4 moma moma 4096 2009-06-19 08:47 p2
drwxrwsr-x 12
moma moma 24576 2009-06-19 08:49 plugins
drwxrwsr-x
2 moma moma 4096 2009-06-19 08:49 readme
Looks good to me.
---------
3) Create a launcher icon for the Eclipse IDE
The
latest
Eclipse version, when ran on Ubuntu 9.10, has a bug related to the
event-system. Read this bug
report...
But you can
easily avoid this error by setting an environment variable before
starting the IDE.
This one-liner shows
how to avoid the error.
$ GDK_NATIVE_WINDOWS=true $HOME/eclipse/eclipse
I
provide here a simple shell script (eclipse.sh) that you can use
directly. Put it to the eclipse/ directory.
Get the script.
$ cd $HOME/eclipse
$ wget
http://www.futuredesktop.org/karmic/eclipse.sh
Make the script
executable
$ chmod +x eclipse.sh
Then start the
Eclipse IDE by running
$ cd $HOME/eclipse
$ ./eclipse.sh
It's best to create a
launcher for
it. Press the right-mouse-button on the desktop surface and select "Create
Launcher..." from the popup-menu.
The command should point to eclipse.sh.
The eclipse directory contains also an icon bitmap (icon.xpm). Point
the icon location to that directory.
See picture 3a.

---------
4) Download Android SDK (Software Developer's toolKit)
Android
SDK contains the application framework; widgets, views and
other Java classes.
It also comes with many tools (in the tools/ directory) and most
importantly, the Android Emulator.
Browse
to http://developer.android.com/sdk/
and get the very latest Android SDK (Software Development toolKit).
Take the newest SDK version for Linux (i386). It will work on all Linux
versions.
I simply click
the android-sdk-linux_x86-1.6_r1.tgz link to start
the download and accept the
license agreement.
This latest SDK supports both version 1.5 and 1.6 of Android platforms.
Again, extract the files to
your home area.
See
picture 4a.

It should create an
"android-sdk-linux_x86-1.6_r1" directory like /home/username/android-sdk-linux_x86-1.6_r1/.
Check the files.
$ ls -l
$HOME/android-sdk-linux_x86-1.6_r1
drwxrwx--- 4
moma moma 4096 2009-09-15 20:14 add-ons
drwxrwx--- 13
moma moma 4096 2009-09-03 20:08 docs
-rw-rw----
1 moma moma 176 2009-09-03 20:08 documentation.html
drwxrwx---
4 moma moma 4096 2009-09-15 20:14 platforms <-- SDK and samples
-rw-rw----
1 moma moma 194 2009-09-03 20:08 RELEASE_NOTES.html
drwxrwx---
3 moma moma 4096 2009-09-03 20:08 tools
<-- some important tools.
Looks good.
Notice: You do not need to remember and write long file and path names
on the command line.
Press TAB-key and command line
will auto-complete file and
path names among other values.
---------
5) Add tools/ to your $PATH
I am considering to
remove this point.
Move to step 6.
The
$HOME/android-sdk-linux_x86-1.6_r1 directory contains a subdirectory
called tools (in my case it is /home/moma/android-sdk-linux_x86-1.6_r1/tools/).
If you want to access these tools from any other directory, you must
add the tools/ path to the global $PATH variable.
Edit your $HOME/.bashrc resource file
$ gedit $HOME/.bashrc
and add
the following blue line to it.
export PATH=${PATH}:$HOME/android-sdk-linux_x86-1.6_r1/tools/
Of
course replace the name android-sdk-linux_x86-1.6_r1 with
correct value in your case.
Gnome-terminal reads the .bashrc
at start. The change take effect after your close and restart your
terminal windows.
Then check the $PATH with
$ echo $PATH
---------
6) Create a Virtual Device
You
will have to create at least one Virtual Device to run Android
application in the emulator.
This device definition determines the phone characteristics in the
emulator.
See: http://developer.android.com/guide/developing/tools/avd.html
Do this:
Cd into the Android SDK's tools directory
$ cd
$HOME/android-sdk-linux_x86-1.6_r1/
$ cd tools
And create an Android Virtual Device (AVD) for an ordinary
Android phone. Give it name "my_avd".
$
./android create avd --target 2
--name my_avd
Android 1.6 is a
basic Android platform.
Do you wish
to create a custom hardware profile [no]
Created AVD
'my_avd' based on Android 1.6, with the following hardware config:
hw.lcd.density=160
The
phone emulator will now use this (first) as default AVD.
List all command line options
$ ./android create avd
List all Virtual Devices
$ ./android list avd
It should list
"my_avd" which you just created.
---------
7) Install Android plugin for the Eclipse IDE
In
this step we will install the ADT-plugin (Android Developer Tools
plugin) in the Eclipse IDE.
It will make
Android development and debugging very easy and straightforward.
Now start the Eclipse IDE and
select Help -> "Install New Software..." from the
menu.
See picture 7a.

The
"Install"
dialog for new software should appear.
Then
press the
[Add...] button and fill in
these values.
Name: Android plugin
Location: https://dl-ssl.google.com/android/eclipse/
See picture 7b.

Then stay
in the
same dialog and wait 5 - 10 seconds. You should first see that the
status changes to "Pending...".
It will now communicate with the Google's site and download the most
recent plugin.
See
picture 7c.

Wait until the
status or text changes to "Developer
Tools".
Then checkmark,
select the "Developer Tools"
and all its subitems as shown in the picture 7d.

--
Click the
[Next...]
button to move forward.
See picture 7e.

Do
nothing in this
dialog.
Again, click
the [Next..] button to
move to the final dialog and accept/confirm the license text.
See picture
7f.

Click the [Finish]
button.
---------
8) Let Eclipse know the location of Android SDK
Eclipse
IDE has to know the location of Android SDK.
It's very easy
to set.
Start the
Eclipse IDE and select Window
-> Preferences from the
main menu.
See picture 8a.

Select "Android"
from the list.
Then click the
[Browse...] button and set the path of SDK Location.
See picture 8b.

Of
course this path must be the same you gave in step 4.
---------
Congratulations.
You are now
ready to start app development on the Android phone.
Besides having a lot of fun you may even earn some money.
9) Create your first Android application
In
this step we'll create a basic Android application (Hello Android) and
run it in the emulator.
This example is a copy of http://developer.android.com/guide/tutorials/hello-world.html
Study it first.
Now, start the Eclipse IDE.
From the main menu select File
-> New -> Project.
See picture 9a.

Further, select "Android Project"
from the list.
Picture 9b.

In the project dialog, punch in the following values.
| Project name: |
Hello Android 1.6 |
| Build target: |
checkmark Android 1.6 (all
new phones are Android 1.6 compatible)
|
| Application name: |
Hello Android (this
will apear as application title in the phone)
|
| Package name: |
com.testcompany.helloandroid
(you might use your own company domain here) |
| Create activity: |
HelloAndroid (this
must be a valid Java class name. Extends the Activity class)
|
| Min SDK version: |
4 (I think
this means Android v1.6) |
See picture 9c.

Click
the [Next] and [Finish] buttons to complete the project.
--
Expand the project items.
Open HelloAndroid.java
file (in src/com.testcompany.helloandroid/) and copy/paste
the following code to it.
Replace the old content.
If you changed the package name (com.testcompany.helloandroid) in
the previous step, change it here too.
//
-------
package
com.testcompany.helloandroid;
import
android.app.Activity;
import
android.os.Bundle;
import
android.widget.TextView;
public
class HelloAndroid extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText("Hello, Android");
setContentView(tv);
}
}
// -------
The
final result should look like this.
See
picture 9d.

Note
that the package name at the top must match the package name in the
res/AndroidManifest.xml file.
Finally compile and run the application in the emulator.
Select Run ->
"Run" from the menu (or press
CNTR + F11 keys).
In the "Run As"
dialog choose "Android Application".
It should
compile and start the emulator for Android Phone. It
may take a
few seconds to fire the emulator at the first time.
The final result
should be this.
Picture 9e.

You may need to
press (or click) the [Menu] button in the emulator.
Do not close the
emulator. All subsequent runs will reload your
application automatically.
Press CNTR + F11 to change the phone's orientation.
Learn more about the Android emulator: http://developer.android.com/guide/developing/tools/emulator.html
---------
10)
Running apps on a real hardware
We
will now prepare your Android phone for application development and
debugging.
10a) First, set your phone for
USB debugging.
In your Android phone, go to Settings
-> Applications -> Development menu, and make sure "USB debugging" is checked
(activated).
See picture 10a.

--
10b) Connect the phone to your
computer via USB cable.
--
Then in your Ubuntu Linux.
10c) Type the lsusb command to list all USB
devices.
$ lsusb
Bus 002 Device
001: ID 1d6b:0002 Linux Foundation 2.0 root hub
...
Bus 001
Device 003: ID 0bb4:0c01 High
Tech Computer Corp. <---
T-Mobile G1
Android phone (if I had one).
Bus 001
Device 003: ID 0bb4:0c02 High
Tech Computer Corp. <--- HTC
Hero Android phone.
...
Bus 003
Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
The listing shows that HTC Hero has VendorID 0bb4 and ProductID
0c02. (0bb4:0c02)
The listing looks correct.
--
10d) In Ubuntu, create a new
rules file for these vendor:device IDs.
Type this command to create the file.
$ sudo gedit
/etc/udev/rules.d/51-android.rules
Add the following blue lines (rules) to it and save the file. If your lsusb command reports other,
newer
product IDs for vendor 0bb4, add
them also to the file.
SUBSYSTEMS=="usb",
ATTRS{idVendor}=="0bb4", ATTRS{idProduct}=="0c01", MODE="0666"
SUBSYSTEMS=="usb",
ATTRS{idVendor}=="0bb4", ATTRS{idProduct}=="0c02", MODE="0666"
See picture 10d.

--
10e) Re-connect your phone.
Your phone should be detected if you unplug and reconnect it to the
computer.
--
10f) Now turn to the Android's adb tool and list all devices and
emulators.
Cd into the tools/ directory.
$ cd
$HOME/android-sdk-linux_x86-1.6_r1/tools
List all Android type devices and emulators.
$ ./adb kill-server
$ ./adb devices
List of devices
attached
emulator-5554
device <--
emulator instance/window.
HT98AL801622
device <--
HTC Hero phone !
You can now access
your phone from the Eclipse IDE and run/debug applications on it.
I like to set the "Deployment Target
Selection Mode" to Manual.
Start
Run -> "Run Configurations..." dialog from
the Eclipse's menu. Select your Android application at the left side,
and click to the [Target] page. Set the "Deployment Target Selection
Mode" to Manual.
This will let you choose between the devices (your phone and emulators)
where to deploy and run your program.
----
10b) Connecting Android-phone to a computer.
Accessing music and photos etc.
It
is quite easy access the the phone's memory card from Linux.
First, connect the phone to your computer via USB cable.
Then switch on the phone and enable
the connection (mounting).
Do this:
On the phone, use your finger + pull and expand the notification area
so you can see all messages.
Notice that the notification list begins from the very top, and you
must
pull downward to see it.
One of the messages should concern the "USB-connection".
Select the "USB connection"
message. Then click the [Mount]
button.
See
picture 10b1.

It
will enable file transfer between the phone and computer.
See
pictures 10b3 - 10b5.
Now you can access
(read and write) files
from/to your phone and the Linux Desktop. |
Your photos and videos
|
And music files
|
 |
 |
 |
Notice: Unmount the memory
card after usage.
It ensures that all
data is written to the device.
See picture 10b6.

I usually also right-click the memory
card icon on my desktop and select "Unmount" or
"Unmount Volume" from the menu. Then it should be safe to unplug the
USB-cable.
---------
11)
More exercises and training
The Android SDK itself comes with many good samples.
The samples lay in
the /home/yourusername/android-sdk-linux_x86-1.6_r1/platforms/android-1.6/samples/
directory.
See: http://developer.android.com/guide/samples/index.html
Start Nautilus file manager (from Ubuntu's Places
-> "Home Folder" menu ;-)
and investigate the files.
See picture 11a.

Study and run them one by one.
Do this to run the
examples:
In the
Eclipse IDE, close
all projects by using the File ->
"Close All" menu.
Then create a new
Android Project from the File
-> New -> Project -> "Android Project" menu.
In the project dialog, select "Create from existing source" and
point the Location to example's root directory (where you
find the AndoidManifest.xml file !).
See picture 11b.

Expand
the project items (files).
An important tip: In some of the
src/*.java files,
the import list is a
bit wrong. Open each of
the src/*.java files and press CNTR + SHIFT + O keys to auto-update the
"import" list.
Save the files. You
have to fix
the import list before compiling.
Then run the project.
Notice: The ApiDemos
sample... is really really important. It demonstrates almost every
aspect of the toolkit. It's THE bible and THE source !
Notice: You can also import projects using the File -> Import..., menu. Then from the list
choose General -> Existing Projects into Workspace.
--
Examples on the developer.google.com.
Browse
to http://developer.android.com/guide/developing
and study + complete the exercises.
--
Source code available on the internet.
Some
books provide source code to all examples on the internet.
Unzip
the code
to a suitable place.
In the Eclipse, close
all projects by using the File
-> "Close All" menu.
Then create a new
Android Project (w/ "Create from existing source") and
point the Location to example's root directory (where you
find the AndoidManifest.xml file).
Run it.
Notice: Some of the
older examples may include a R.java
file in the project's src/*
folder. Delete it from there. R.java is always auto-generated and saved
in the gen/* folder.
- "Android
Essentials" book from Apress. Download
its Source
Code...!
and
compile + run as
shown in the previous steps.
- "Pro Android" book
from
Apress. Get its Source
Code...! (afaik: contains only the code w/o project files).
- "Professional Android
Application Development" book from Wrox. Get the Source
Code...!
This bundle contains
many good examples.
Comprises of several zip-files.
Unzip each of them.
I simply ran the
following command (in the actual directory): for i in
*.zip; do unzip "$i"; done
Use may also try the Eclipse's File
-> Import... command.
Select General -> "Existing Projects into
Workspace" from the list.
Then choose "Select archive file"
(a zip file) in the import-dialog.
- "Unlocking Android,
developers guide". Get the Source code...!
---------
12)
Publishing your applications
Google does not take
royalties for your code and work. You are free to sell or give away your
work at the Android's market place.
See: http://www.android.com/market/
There are both commercial and free Android applications.
Read more about
signing and publishing
http://developer.android.com/guide/publishing/app-signing.html
---------
13)
Testing various configurations
In
the step 6) you created "my_avd" Android Virtual Device. This was
your default configuration.
But it's very easy to add other device configurations as well.
Start Run -> "Run Configurations..." dialog from
the menu.
See picture 13a.

Select your project (eg. HelloAndroid) from the list and click on to
the "Target" tab page as shown.
Then click the [AVD Manager...]
button.
Create additional configurations (Android Virtual Devices). I like to
test my
apps with different skins and phone orientations (landscape/portrait).
See picture 13b.

Then
Run your application and select a device config.
Note: I've set the "Deployment Target
Selection Mode" to Manual in
the "Run Configurations..."
dialog (see the picture 13a above).

--
Of course you could
create these AVDs from command line too.
The create avd command
can take
various options.
Eg. you can
determine the amount of memory on the target phone, version of the
target SDK and size of the simulated SD memory card.
You can
also change the phone's skin, face with the --skin option. Click here...
to see the various skin types and names. The skin names have totally
changed between Android SDK 1.5 and 1.6.
Use the --force
option to modify an existing AVD.
Here
is an example.
$ cd
$HOME/android-sdk-linux_x86-1.6_r1/
$ cd tools
$ ./android create avd
--force --target 2 --name "skin-QVGA" --skin QVGA
AVDs are saved in /home/yourusername/.android/avd/ directory.
---------
14)
Using the Android tools
The
Android
SDK includes several handy tools.
Read: http://developer.android.com/guide/developing/tools/index.html
Take a listing of the tools directory.
$ cd ~
$ cd android-sdk-linux*
$ cd tools
Now you should be in the /home/username/android-sdk-linux_x86-1.6_r1/tools/
directory.
List the programs
$ ls -l
-rwxrwxrwx 1 moma
moma 332723 2009-09-03 20:08 adb
-rwxrwxrwx 1 moma moma 3526 2009-09-03 20:08 android
-rwxrwxrwx 1 moma moma 2382 2009-09-03 20:08
apkbuilder
-rwxrwxrwx 1 moma moma 3514 2009-09-03 20:08 ddms
-rwxrwxrwx 1 moma moma 74379 2009-09-03 20:08 dmtracedump
-rwxrwxrwx 1 moma moma 1940 2009-09-03 20:08
draw9patch
-rwxrwxrwx 1 moma moma 5710146 2009-09-03 20:08 emulator
-rwxrwxrwx 1 moma moma 1987 2009-09-03 20:08
hierarchyviewer
-rwxrwxrwx 1 moma moma 23084 2009-09-03 20:08 hprof-conv
drwxrwx--- 4 moma moma 4096 2009-09-03 20:08 lib
-rwxrwxrwx 1 moma moma 16598 2009-09-03 20:08 mksdcard
-rw-rw---- 1 moma moma 169407 2009-09-03 20:08 NOTICE.txt
-rw-rw-rw- 1 moma moma 33 2009-09-03
20:08 source.properties
-rwxrwxrwx 1 moma moma 1250507 2009-09-03 20:08 sqlite3
-rwxrwxrwx 1 moma moma 3871 2009-09-03 20:08 traceview
-rwxrwxrwx 1 moma moma 185477 2009-09-03 20:08 zipalign
If
you want to run a tool you have to cd into the tools/ directory first.
We decided not
to complete the step 5) and the tools/ directory is
not in the global $PATH.
I will show you some examples here.
Where are you now?
$ pwd
/home/moma/android-sdk-linux_x86-1.6_r1/tools
Working with the adb (Android Device Bridge) command.
See:
http://developer.android.com/guide/developing/tools/adb.html
Let's first query
all emulator instances. The port-number or name of the emulator is
quite important here.
You have to prefix the command with ./
(it means the current directory).
$ ./adb devices
List of devices
attached
emulator-5554
device
<-- notice the name and port number "emulator-5554".
emulator-5556
device
<-- my second emulator instance.
HT98AL801622
device <--
HTC Hero Android phone (real device).
If the listing is
empty, start eg. your Hello Android application from the Eclipse.
You
can have several emulators or real phones up and running at the same
time.
Then
remote-connect to
the emulator instance or device.
You must know that the emulator is similar to a real Android-phone,
they both run an ARM CPU based
Linux
kernel.
This
command will connect to the emulator instance and start a remote shell.
$ ./adb -s
emulator-5554 shell
See
picture 14b.

You
should see a shell (bash #) prompt.
You
are
logged in as the "root" admin user. Be careful beacuse it has all
rights.
...
<todo>
Simulate phone calls and send SMS
Read:
http://developer.android.com/guide/developing/tools/emulator.html#console
<todo>
--
Hacking Android's data with sqlite3
See:
http://developer.android.com/guide/developing/tools/adb.html#sqlite
Android phones
contain a sqlite3 database engine. It's very fast and easy to use.
All programs can
create their own databases in addition to the Android's pre-installed
datafiles such as contacts.db,
mmssms.db and telephony.db.
You
must remote connect to the Android emulator or device to examine the
databases.
I repeat the basic commands here.
$ cd
$HOME/android-sdk-linux_x86-1.6_r1/tools/
$ ./adb -s
emulator-5554 shell
You are now
connected to the device and command prompt # appears.
The /data/data/ directory contains the names of all packages
and
their sqlite3 databases.
Cd into the /data/data/ directory.
# cd /data/data
# pwd
/data/data
List all package names first.
# ls
-l
List all
database files (*/databases/*.db)
# ls -l */*/*db
I also used this
command to find the *.db files.
# for
i in *; do echo $i; ls -l $i/databases/; done
(I have edited the output a bit)
/data/data/com.android.alarmclock/databases/
-rw-rw----
app_0 app_0
4096 2009-08-26 13:06 alarms.db
/data/data/com.android.launcher/databases/
-rw-rw----
app_3 app_3
4096 2009-08-26 13:06 launcher.db
/data/data/com.android.providers.contacts/databases/
-rw-rw----
app_3 app_3 54272
2009-08-26 17:49 contacts.db
/data/data/com.android.providers.downloads/databases/
-rw-rw----
app_4 app_4
5120 2009-08-26 13:06 downloads.db
/data/data/com.android.providers.media/databases/
-rw-rw----
app_4 app_4 29696
2009-08-26 17:56 external-13031c18.db
-rw-rw----
app_4 app_4 23552
2009-08-26 13:06 internal.db
/data/data/com.android.providers.settings/databases/
-rw-rw----
system system 19456
2009-08-26 18:39 settings.db
/data/data/com.android.providers.telephony/databases/
-rw-rw----
radio radio 30720
2009-08-26 13:06 mmssms.db
-rw-rw----
radio radio
9216 2009-08-26 17:56 telephony.db
/data/data/com.android.providers.userdictionary/databases/
-rw-rw----
app_3 app_3
4096 2009-08-26 13:06 user_dict.db
---
Now let's study
some data.
While in the /data/data/ directory, start the
sqlite3 database manager with contacts.db database as argument.
As you already understand, we are running the sqlite3 command in
(inside) the emulator or phone device.
# sqlite3
com.android.providers.contacts/databases/contacts.db
SQLite version 3.5.9
Enter ".help" for instructions
sqlite>
Try the "help" command first (note the dot).
sqlite> .help
...
List all tables in the contacts.db database.
sqlite> .tables
_deleted_groups
contact_methods peopleLookup
_deleted_people
extensions
phones
_sync_state
groupmembership
photos
_sync_state_metadata
groups
settings
android_metadata
organizations
voice_dialer_timestamp calls people
Retrieve all rows from the people table.
You may first add some entries to the emulator's/phone's contacts list.
Terminate the SQL command with ";".
sqlite> select * from
people;
...
Print schema
sqlite> .schema people
...
And finally quit the sqlite3 manager.
sqlite> .quit
--
Press cntr + d or type exit to terminate the remote (shell)
connection.
Starting with Java
programming
http://java.sun.com/docs/books/tutorial
Android SDK 1.6 demonstration and motivation
videos
http://www.youtube.com/MBRFkLKRwF...
http://www.youtube.com/I6ObTqIiYfE...
Other
important guides
http://developer.android.com/guide/
This is especially for newbies
http://developer.android.com/guide/developing/eclipse-adt.html
Designing activities (programs)
http://developer.android.com/guide/practices/ui_guidelines/activity_task_design.html
Porting OpenGL to
Android
http://insanitydesign.com/wp/projects/nehe-android-ports/
Android
applications
http://en.androidwiki.com/wiki/Applications
Android
beginners'
and developers' mailing lists
http://groups.google.com/group/android-beginners
http://groups.google.com/group/android-developers
Samples
http://wiki.andmob.org/samplecode
-- the end --
Return to http://www.futuredesktop.org