In this presentation, we will provide an overview of native Android tooling and some of its uses. We will also cover several Android specific concepts and APIs and discuss how you can use them when creating a best of breed application.
Tooling
- DDMS
- adb (Android Debug Bridge)
- android (Downloading SDKs, Managing AVDs)
APIs
- Android Lifecycle Events
- Intents, Activities, Notifications
- Javascript Activities
- Resources
- Android Section of tiapp.xml
3. Android Debug Bridge (adb)
• the swiss army knife of Android, tons of
commands, works with emulator & device
• push / pull: upload / download files
• install / uninstall applications
• shell: full /bin/sh system access
• logcat: app / device logging
http://www.appcelerator.com | @appcelerator 3
4. DDMS
• Graphical frontend to adb, and other
android SDK tools
• App process control
• Colored Logcat output
• Mock Geo / Phone call / etc control
• Minimal memory / cpu profiling
http://www.appcelerator.com | @appcelerator 4
5. Other Android SDK Tools
• android
– manage virtual devices (emulators w/ versions, SDcard
size, etc)
– SDK updates, extras
• “hierarchyviewer”:
– Layout / UI debugging tool
• “traceview”
– Visual call hierarchy / CPU profiling
• Much more, See the official Android docs (links
at the end)
http://www.appcelerator.com | @appcelerator 5
6. Android Concepts
• Application
– Collection of one or more Activities
• Selected by OS w/ Intent filters
– SDK version compatibility (API Level)
• Intent
– Fully serializable data, used between Activities
– Various fields/options
• Action (VIEW, EDIT, SEND, etc), Data (URI)
• Category (CATEGORY_LAUNCHER etc)
• Mime type (e.g. vnd.android.cursor.item/phone)
• Class name (e.g. com.mycompany.Activity)
• Extra’s - Custom key/value pairs
http://www.appcelerator.com | @appcelerator 6
7. Android Concepts
• Activity
– Task Stack
• Inter-app + screen navigation
– App entry point
– Handle system+custom intents
• Can return values to other activities
• Others
– Service
– Notifications, PendingIntent
http://www.appcelerator.com | @appcelerator 7
8. App/Activity Life Cycle
• User launches app
– Intent is fired to app
with:
• category:
CATEGORY_LAUNCHER
• action: MAIN
http://www.appcelerator.com | @appcelerator 8
9. How do I do that with Ti?
• Custom JS Activities
– JS Activities can be simple (launched via URL) or complex
(launched via intent filter from the system)
– Configured via tiapp.xml
• Everything else (mostly) follows a 1:1 mapping w/
official Android API
– All constants / create* methods live in Ti.Android
– i.e. Ti.Android.createIntent
– Access current activity with Ti.Android.currentActivity
– Activity.startActivityForResult supports a function
callback for convenience
http://www.appcelerator.com | @appcelerator 9
10. Resources
• Use Android density / orientation res
specifiers in Resources/android/images
• Arbitrary android native resources can live
in project s platform/android
http://www.appcelerator.com | @appcelerator 10
13. Javascript Engines
• Rhino
– Our current Javascript Engine
– Java based which allows it to work on devices
without NDK support
• V8
– Used in Chrome, Chromium, NodeJS, and more
– C++ based requires NDK support
– Performance 2X minimum, in many cases 10-15x
http://www.appcelerator.com | @appcelerator 13