easier android development with titanium
DESCRIPTION
Tips and tricks to make your Android development with Titanium as painless as possible. Android can be as functional and (almost) as performant as iOS with less 'if' statements. From #ticonf Australia, August 2013.TRANSCRIPT
Jeff Bonnes
twitter: @titaniumdev
http://www.titaniumdevelopment.com.au
Easier Android Development
Agenda
• Android Market and Behaviours
• Planning your App
• Smarter Defaults
• Tips, Tricks and Advice
Background
App Download Culture
0
25
50
75
100
iOS Android
App Download Culture
Android by the numbers• Australian Market Share (Dec 2012)
0% 10.0% 20.0% 30.0% 40.0% 50.0% 60.0% 70.0% 80.0% 90.0% 100.0%
iOS Android
Android by the numbers
• Australian Market Share (Dec 2012)
• US Market Share
• Why?
X-platform Examples
X-platform Examples
X-platform Examples
X-platform Examples
Before you code• Target API?
Before you code• Devices / Screen Sizes?
Coding Approaches
• Different Apps
• Different UI Code
• Different CommonJS Modules
Project Setup
• dps vs pixels
• density specific images
Project Setup
• Other tiapp.xml values
Development Workflow• You are using TiShadow, aren’t you?
• fastdev
• Android 2.3 in Emulator, 4.x on device
• Intel x86 Atom System Image: no Google APIs :-(
• VM for Emulator
• tracer.js
Navigation
Action Bar
• Android 3.0+ only
• Must use Heavyweight windows
Alternate Navigation• TiXUI
• title
• titleControl
• barImage
• rightNavButton
• leftNavButton
require('xui').createWindow();
Light vs Heavy Windows
• Activity
• Back Button
• Animation
• activityEnterAnimation
• activityExitAnimation
• Memory?
• fullscreen• navBarHidden• modal• windowSoftInputMode
Images
• Don’t allow Android to stretch images
• Don’t use images for backgrounds (especially windows!)
Show only what you need
• Things are S L O W E R
• JSON Parsing
• SQLite Updates
• event firing
• Load things only as you need them
Freeing Resources
• Close Windows
• Memory Debugging
• Instruments first
• then DDMS
Intents
• Do less work - use less frameworks
• See Titanium.Android.Intent
Packaging Tricks
• Image Compression
• uses-feature
• Icons - drawables (http://ticons.fokkezb.nl/)
Thank You!
• twitter: @titaniumdev
• http://www.titaniumdevelopment.com.au
• https://github.com/jeffbonnes/TiXUI