Don Thorp & Marshall Culpepper: Advanced Titanium Development for Android

1,448 views

Published on

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

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,448
On SlideShare
0
From Embeds
0
Number of Embeds
261
Actions
Shares
0
Downloads
33
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Don Thorp & Marshall Culpepper: Advanced Titanium Development for Android

  1. 1. Advanced  Titanium  Development  for  Android   Don  Thorp  &  Marshall  Culpepper    
  2. 2. Android Tooling•  Android Debug Bridge (adb)•  DDMS (Dalvick Debug Monitor Server)•  “android”•  “hierarchyviewer”•  “traceview” http://www.appcelerator.com | @appcelerator 2
  3. 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. 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. 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. 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. 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. 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. 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. 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
  11. 11. tiapp.xml examples http://www.appcelerator.com | @appcelerator 11
  12. 12. JS Exampleshttp://www.appcelerator.com | @appcelerator 12
  13. 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
  14. 14. Titanium+Android Demos http://www.appcelerator.com | @appcelerator 14
  15. 15. Links!•  Android Tools: http://developer.android.com/guide/developing/ tools/index.html•  Ti.Android module: http://developer.appcelerator.com/apidoc/mobile/ latest/Titanium.Android-module•  Services in Titanium: http://developer.appcelerator.com/doc/mobile/android- simple-services http://www.appcelerator.com | @appcelerator 15

×