This document provides an overview of developing Android applications from a top-down perspective. It discusses the development environment including Java, C/C++, and the Android SDK. It also describes the key components of an Android application like activities, services, broadcast receivers and content providers. Finally, it covers debugging tools and techniques.
4. Development Environment
• Java development kit (version 1.6 or higher)
• Android SDK
– Java classes for Android components
• IDE
– Google recommends Eclipse 3.4 or 3.5
• Android Development Tool (ADT) for Eclipse
• Android NDK (optional)
– Tool chain for compiling C/C++ into shared object
files
5. Installing ADT/SDK/NDK
• Installing ADT in Eclipse
– Start Eclipse, then select Help > Install New Software
– In the Available Software dialog, click Add...
• In the Add Site dialog that appears, enter this URL in the
"Location" field.
– https://dl-ssl.google.com/android/eclipse/
• Or download the ADT plugin zip file and click Archive in the
Available Software dialog
– Next, next, next…
• Configuring the Android SDK
– Run Android SDK manager and download “SDK Platform”
– Select Window > Preferences > Android
– Browse and select your SDK directory
• Add /path/to/your/ndk/directory/ to $PATH
9. Android Key Components
• Activity
– UI
– One activity at a time
• Service
– May continue working even the application is not in the
foreground
– Expose method interface to Activity (like Java RMI)
• Broadcast receiver
– Listen to specific action(s)
– IPC
• Content provider
– SQL-like
10. Activity Lifecycle
• onCreate()
– Set up activity layout
• onStart()
– Set event listener
– Run methods
– Initialize service or
BroadcastReceiver
• onStop()
– Do cleaning methods
13. Compiling Codes Through NDK
• Claim native methods in Java
• Generates JNI header by javah
• Write C/C++ program
• Android.mk
– include $(BUILD_SHARED_LIBRARY)
• ndk-build
14. Android Virtual Device
• Simulating events
– Incoming calls, SMS…
• No support for the following items
– placing or receiving actual phone calls
– USB connections
– camera/video capture (input)
– device-attached headphones
– determining connected state
– determining battery charge level and AC charging state
– determining SD card insert/eject
– Bluetooth