Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
• Activity manager
• Package manager
• Window manager
• Resource manager
• Content manager
Hardware Services
• Telephony
• Location
• Bluetooth
• WiFi
• USB
• Sensor(s)
How Android boots
How Android boots:
Init
• Qualcomm h264 codec frontend (does some processing the dsp cannot do)
• http://source.android.com/download
Setting up your
machine
• Android development can be done on
• Ubuntu 32 bit (preferred)
• Ubuntu AMD64
• MacOS X
• http://source.android.com/download
Setting up your machine (2)
• Steps (at a glance)
• You might also want Valgrind, a tool that will help you find memory leaks, stack
corruption, array bounds overflows, etc.
• libreadline
G1 vs ADP1
Netbooks
Ports
• Nokia Internet Tablets
• Sharp Zaurus
• HTC Models
• Kaiser,Vogue, Polaris, Titan, Raphael &
Diamond
• OpenMoko FreeRunner
Application
Development
Nathan Freitas
The Basics
with
(or w/o)
Android 1.1 SDK r1 Eclipse IDE
http://developer.android.com
Hello, Android
1)
3)
2)
All the Tools Fit....
Android Emulator: A virtual mobile device that runs on your computer.You use the emulator to design, debug, and test your applications in
an actual Android run-time environment.
Android Development Tools Plugin (for the Eclipse IDE): The ADT plugin adds powerful extensions to the Eclipse integrated
environment, making creating and debugging your Android applications easier and faster. If you use Eclipse, the ADT plugin gives you an incredible
boost in developing Android applications.
Hierarchy Viewer: The Hierarchy Viewer tool allows you to debug and optimize your user interface. It provides a visual representation of your
layout's hierarchy of Views and a magnified inspector of the current display with a pixel grid, so you can get your layout just right.
Draw 9-patch: The Draw 9-patch tool allows you to easily create a NinePatch graphic using a WYSIWYG editor. It also previews stretched
versions of the image, and highlights the area in which content is allowed.
Dalvik Debug Monitor Service (ddms): Integrated with Dalvik, the Android platform's custom VM, this tool lets you manage processes on
an emulator or device and assists in debugging.You can use it to kill processes, select a specific process to debug, generate trace data, view heap
and thread information, take screenshots of the emulator or device, and more.
Android Debug Bridge (adb): The adb tool lets you install your application's .apk files on an emulator or device and access the emulator or
device from a command line. You can also use it to link a standard debugger to application code running on an Android emulator or device.
Android Asset Packaging Tool (aapt): The aapt tool lets you create .apk files containing the binaries and resources of Android
applications.
mksdcard: Helps you create a disk image that you can use with the emulator, to simulate the presence of an external storage card (such as an
SD card).
What’s in an App?
Libraries
Other
Default Other Service
Activities
Other
Activity Intents Activities
Activities Content
Providers
Android Manifest
</application>
</manifest>
Config & Code Editing
Laying it All Out
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollReportForm"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/inaug_report_no_seal_">
<LinearLayout
android:id="@+id/layoutReportForm"
android:label="Text Report"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" android:gravity="top"
android:padding="6.0sp">
<TextView android:id="@+id/labelTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Title:"/>
<EditText android:id="@+id/entryTitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"
/>
<TextView android:id="@+id/labelReport"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="10dp"
android:text="Your Report:"/>
Activity: Do Something!
/** Called when the activity is first created. */
@Override
package com.openideals.inaugreport; public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
import android.app.Activity;
import android.app.ProgressDialog; setContentView(R.layout.reportform);
import android.content.Intent;
import android.location.Location; ((Button)findViewById(R.id.btnReportFormSubmit)).setOnClickListener(this);
import android.os.Bundle; ((Button)findViewById(R.id.btnReportFormCancel)).setOnClickListener(this);
import android.os.Handler;
import android.util.Log;
import android.view.View; }
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.Spinner;
import android.widget.TextView; Toast.makeText(getBaseContext(), "There was
import android.widget.Toast; a problem submitting your report. Wait a second, and then
try again!", Toast.LENGTH_LONG).show();
import com.openideals.android.geo.LocationFinderActivity;
import com.openideals.android.ui.HorizontalSlider;
import com.openideals.android.ui.HorizontalSlider.OnProgressChangeListener;
private void showMain ()
} {
Intent iMain = new Intent(this, LocationFinderActivity.class);
startActivity(iMain);
}
“DDMS” Debugger
Launch the Emulator!
Title
OpenIntents.org
Action Description
Call android.intent.action.CALL Perform a call to someone specified by the data.
Capture an image android.media.action.IMAGE_CAPTURE An application implementing this intent protocol allows the user
to capture an image.
Check for Update org.openintents.intents.CHECK_VERSION Preliminary protocol until Market improves update facitilities!
Connect host org.theb.ssh.action.CONNECT_HOST Connect to a host.
Create shortcut android.intent.action.CREATE_SHORTCUT Creates a shortcut on the main screen.
Delete data android.intent.action.DELETE Delete the given data from its container.
Dial a number android.intent.action.DIAL Dial a number as specified by the data.
Edit data android.intent.action.EDIT Provide explicit editable access to the given data.
Resolve unresolved intents org.openintents.intents.UNRESOLVED_INTENT Delegates the user to a selection of possible applications that
can resolve the given intent.
Ringtone picker android.intent.action.RINGTONE_PICKER Show a ringtone picker.
Scan com.google.zxing.client.android.SCAN Scan a barcode.
Search android.intent.action.SEARCH Perform a search.
Search book contents com.google.zxing.client.android.SEARCH_BOOK_CONTENTSUse Google Book Search to search the contents of the book
provided.
Send a message to the given uri android.intent.action.SENDTO Send a message to someone specified by the data.
Send data to someone android.intent.action.SEND Deliver some data to someone else.
Send Twitter Message com.twidroid.SendTweet Send a Twitter/Identi.ca Message thru Twidroid.
Set wallpaper android.intent.action.SET_WALLPAPER Show settings for choosing wallpaper
Share (through QR code) com.google.zxing.client.android.SHARE Display an item as QR code to scan with a phone.
Show about dialog org.openintents.action.SHOW_ABOUT_DIALOG Show an about dialog to display information about your
application.
Show radar com.google.android.radar.SHOW_RADAR Display a radar like view centered around the current position
and mark the given location
Tag data org.openintents.action.TAG Add a tag to the given data.
View data android.intent.action.VIEW Display the data to the user.
Web search android.intent.action.WEB_SEARCH Perform a web search.
Geo Report App
GeoMapping Results
PhoneGap “webOS”
• PhoneGap is a development
tool that allows web
developers to take advantage
of the core features in the
iPhone, Android, and
Blackberry SDK using
JavaScript.
Application
Development
Nathan Freitas
nathan@olivercoady.com
blog: openideals.com
consulting: olivercoady.com
Phone Hacking
Getting root
By getting root you can update the bootloader and
install custom firmware
Why custom firmware?
• Include bug fixes from git
source
• add useful kernel modules
(ext2, cifs, ++) unionfs