Sunday 28 October 2012

Droidcon London 2012, Day Two

The second day of Droidcon London — and they kept us going from 9am until 7pm with a full programme! As with the previous day, the keynotes were focussed on how Android is being used in non-phone devices — extending the rule of configurable software over fixed hardware.

I’d really like to add the slides to these notes — the Flurry presentation especially has loads of useful information that I didn’t catch. If any of the authors read this — please get in touch via twitter or leave a comment and I’ll add a link!

Future of Android - Vendscreen

Paresh Patel

http://www.vendscreen.com/

  • touchscreen device that fits as an extension on any vending machine
  • accepts credit cards via swipe + tap to pay
    • chip & pin coming later
  • network connected — makes the machine smarter
  • can cluster machines
    • e.g. lots of machines in a hotel
    • customers can get inventory from their phone
    • energy management — can turn off some
  • example: sold small artwork pieces in a vending machine
    • people weren’t surprised
    • prices didn’t have to be low
    • people paid up to $99 by swiping their card
  • right now running Android 2.3.4
  • minor modifications:
    • got rid of desktop
    • added a recovery screen

Future of Android - Parrot Asteroid

Frederic Albinet

http://www.parrot.com/uk/products/hands-free-car-kits/parrot-asteroid

  • parrot asteroid Android car radio
  • classic & mini using Android 1.5(!!?!)
  • tablet and smart devices using Android 2.3 (still old…)
  • does voice recognition search for contacts and music
    • music searches across connected device and also the internet radio stations and other sources
  • parrot app market
    • will be live from november
    • can browse from PC or from device
  • looking to extend to dynamic network between vehicles
    • though this would depend on other cars having devices with the same protocol…

ADzero phone launch

http://www.justadzero.com/

  • world’s first bamboo smartphone
  • quad core device
  • full HD screen
  • bamboo feels really good to hold
  • flash innovation: circle around the camera — works much better for macro

building songkick

Akshay Dashrath and Jamie McDonald, Novoda

  • took 2 devs 3 months to build initial version
  • agile process, two week iterations
  • tools used:
    • pivotal tracker
    • github
    • maven
  • third party libs:
    • ActionBarSherlock
    • ViewPagerIndicator
    • Novoda ImageLoader & Novocation
    • NovodaTime — dealing with Joda Time problems

user experience design

  • spent a lot of time finding pain points in initial install process using paper prototypes
  • found out that putting buttons in the action bar were not found by users
    • mocked up on an actual device to see how it felt
  • can set a custom notification light colour (works well with branding!)
  • styled login web view to look like rest of app
  • first launch experience:
    • had a scan screen with an OpenGL animation to keep the user entertained while the initial artist information is found
  • used external apps that expose content providers
    • google music — got artist names using a projection and flexjson to push it to songkick server
    • last.fm

caching & location

  • used novoda’s novocation location library
  • used Jackson mixture of streaming & tree model to avoid memory issues
  • data from web calls loaded into database, then database loaded into views with cursor loaders
  • detachable result receiver — google IO 2011 app
    • lets you deal with rotating views and re-attaching the new activity to the old cursor loader
  • all visited content cached using Reto Meier’s Big Cookie approach (see Making Good Apps Great)
    • “Just Added” concerts sync in the background
  • if offline, then shows a transparent banner at the bottom of the page
    • send out a sticky broadcast if an online query fails
    • broadcast cleared if the app gets a good response
  • Big Cookie caching can build up too much data
    • data removed on a daily basis by removing old data — e.g. past concerts, etc

testing

  • manual QA for most stuff
  • automated tests were more for stress testing
  • also did observational user testing (one-way mirror room)
  • put UI options in a debug menu so could easily do A/B testing
  • build machine runs instrumentation tests on however many devices are plugged into it
  • used Eclipse Memory Analysis Tool to check memory allocation
    • used to fix large back stack activity
    • enabled StrictMode to deal with issues with Google Analytics & Joda Time
    • Joda Time used the UI thread for DST settings (can be fixed — see Stack Overflow)
  • got featured in Play
    • installs went 400 / day -> 20,000 / day!

soundcloud audio in Android

Jan Berkel and Jon Schmidt, SoundCloud

playback

  • Java MediaPlayer talks to C layer MediaPlayerService
    • check out the C source code to see what’s going on
  • underneath this uses PacketVideo OpenCore up to 2.2, then Google Stagefright
    • shouldn’t have to care about underlying implementation but if you’re doing something complicated you do…
    • OpenCore
      • mature, stable but limited
      • seekTo doesn’t work in streams
    • Stagefright (default from 2.2 and beyond)
      • fixes seeking
      • but not available in all devices…
  • when launched shortly after 2.3 released decided to support 2.1+ so that could cover 75-80% of devices
  • to find out which mediaplayer, tried to read /system/build.prop
  • however, some phones had both frameworks!
    • one for streaming and one for encoding…
    • playing locally would behave differently than streaming from a server
  • so to actually find out, connect the MediaPlayer to a local socket and read the user agent on the other end…
  • built a StreamProxy local server
    • could cache and fetch chunks from CDN
    • MediaPlayer then talks to proxy
    • inspired by NPR android app
    • but still no control over buffering (may want to alter it depending on network conditions)
    • different versions of Android behave differently
      • ICS has a huge buffer so takes ages before it starts playing…
  • bundled Android HttpClient is broken (it’s an old snapshot, not a proper release)
    • have to catch NPE from execute!
    • recommended to use standard Java URLConnection
    • bundled HttpClient has now been deprecated

recording

  • live encoding options on earlier Android versions — just AMR AB
    • only good for voice
    • narrow range, low quality — sounds like a phone call
  • instead recorded in PCM and used 3rd party lib to encode it before uploading
  • chose ogg vorbis
    • good for licenses
    • java port is slow (and incomplete)
    • would take 4x length of audio to encode!!
  • from 2.3.3 Android introduced AAC encoding
  • new requirements involved getting at the actual audio data — simple editing, resuming record
  • had to write own native layer for codecs and audio processing (Java too slow)
    • used C-based Vorbis Encoder & Decoder with a thin wrapper
    • also added a native amplitude analyzer
  • tried to avoid sending data back and forth too often
  • but… now had to deal with CPU flavours
    • armv5 on older devices has no floating point support
    • have to build native pieces for various architectures (armv7, mips, x86)
    • older devices fall back to old-style encode later style
  • Jelly Bean has new media encoding APIs
    • will be useful in the future…
  • some sony devices have a patched media framework that behaves differently…

bug detection

  • robolectric
  • bugsense crash reports
  • get a load of devices and get people to use them

The fly-in app menu for designer and developer

Cyril Mottier @cyrilmottier

  • watch out for activity back stack
    • recommended to only use fly-in menu at root level
    • but still want the back button to exit the app without going via the fly-in menu
  • libraries (all on github)
    • android-undergarment
    • slidingmenu
    • android-menudrawer
  • don’t slide the actionbar
    • you’d need a custom actionbar…
  • or create your own: need a custom view group & view
  • see “making of prixing”
  • make the slid out activity inactive
    • click on it to make it visible again
  • may need to think about right-to-left languages having right-sliding menus

Who needs thumbs? Android Instrumentation and Reverse Engineering

David Teitelbaum http://blog.apkudo.com/

I only caught the very end of this, but it looked like it could be a really useful talk — worth chasing down the slides

Android and Arduino

Fei Manheche, Robobo

  • 3 steps:
    1. build basic circuit & test it from PC (use serial monitor via direct connection or Bluetooth)
    2. build basic arduino software to set it up to be controlled from Android
    3. build Android app to talk to Arduino
  • bluetooth modules available for £6-10
  • use amarino library to simplify bluetooth between android and arduino
    • can also use amarino app to test basic bluetooth connection
  • don’t send too much data to the arduino at once (unless you write buffering serial code on the arduino…)

Memory Analyzer: avoiding memory leaks

Felipe Ferraz, CESAR

  • each process on Android has its own Dalvik VM
  • the Zygote process is forked for each app
    • it already has common libraries mapped into it, so they’re shared as read-only between all apps
  • use adb to make a heap dump (kill -10 <pid>)
    • or use Eclipse…
  • useful to create multiple heap snapshots to tell story of memory leak
  • http://www.eclipse.org/mat/
  • make sure to null Callables inside Images

Using Ubuntu to develop cloud-connected android apps

Victor Palau, Ubuntu

  • juju: https://juju.ubuntu.com/
  • orchestrates groups of servers deployed to cloud systems
  • can deploy a local instance or to Amazon ECS (or any other OpenStack compatible service)
  • local deployment uses zookeeper to set up containers on a single machine

Mobile Analytics - taking your Android app to the next level

Simon Podd, Director of Sales, Flurry EMEA

  • according to EMF there are 2Bn “affluent adults” in the world
  • 17% of time spent in Android apps is in Europe
  • time spent in apps is increasing month by month (94mins/day in Dec 2011)
  • social networking category is growing fast (equal to games in Q1 2012)
  • Flurry tracking 220K apps across 660m devices
  • iPad makes up 88% of top 3 tablet sessions
  • of the top 20 Android devices by worldwide sessions (May 2012), the top 3 are:
    1. Galaxy SII
    2. Galaxy Ace
    3. Moto Defy
  • worldwide 2011 app revenue (iOS & Android):
    • 52% in-app purchases
    • 24% mobile advertising
    • 25% app sales
  • advertising revenue (from Flurry’s ad slots):
    • iOS $6-10 eCPM
    • Android $20-30 eCPM

gaming category stats

  • ages 13-34 spend most time in apps
    • 18-24 & 25-34 about even
    • fairly even gender split
  • more money spent by 25-34yo men (29%)
  • average transaction sizes fairly constant across ages, and higher than you might think:
    • M: $15.60
    • F: $11.90
  • customers download on average 50-85 apps during a device lifetime
  • but they only use 5-10 apps a day
  • there’s an app discovery issue on the device

flurry tracking

  • can use ranges for event parameters…

Applying lean principles to enterprise mobile development

Dave Slocombe @daveslocombe — Head of Mobile Channel, lastminute.com

  • product scorecards
    • 5 or 6 key goals for the year
    • see Marty Cagan, SVG
  • keep time to release short
    • don’t miss the opportunity to innovate
  • avoid big bang releases
  • essentials: co-location & cross-functional

generating and managing ideas

  • ideas should come from all sides of the business
  • need to have a massive bucket of ideas
  • make them visible so you can choose amongst them
    • great for managing HiPPos (highest paid persons)
    • they can see that their idea is on the board
  • doesn’t mean that you have to work on them!
  • prioritise ideas
    • use the product scorecard

selecting ideas for development

  • UX team does customer insights
    • qualitative: what problems are we solving? is there a market?
    • quantitative: talking to data analysts
    • looking for strong signals
  • product owner reviews customer insights
  • UX team create designs in iterations, increasing fidelity as they go
    • want to be able to ditch bad ideas before spending too much time on them
    • try guerilla testing: take it to someone in a coffee shop and ask them what they think
    • get marketing and devs involved as well
  • get UX ideas out without using developer time
    • use axure or similar
  • have an internal site of proposed designs
    • available to exec team
  • play back early stage designs to other teams, like finance and supply
    • surface problems and feedback early
  • if ideas are generated, they can go back onto the ideas board (don’t deal with them right now)

development processes

  • retrospectives
    • done every two weeks
    • if you leave it longer, the issues get bigger and harder to solve
    • more frequent = smaller, easier to fix issues
    • e.g. found that they needed a “design issues” wall
      • edge cases found missing by the designer, not captured
      • introduced “creative coding” — designer + developer pairing, making a first pass of the UI
      • brings designers into what’s possible on mobile
      • helps devs understand value of brand & aims of user experience
  • Dave was originally a skeptic of pairing, but converted:
    • sharing knowledge
    • repeatability, consistency
    • drives out “hero developer” mentality

testing & releasing

  • “release process is the metronome that drives progress”
  • continuous deployment
    • every check-in should be deployable
    • repeatable consistent environments
    • currently 12mins to deploy to production
  • devices are tiered for testing:
    1. automated tests, max experience, manual test
    2. automated tests, optimum, limited manual
    3. observe trending, monthly testing, graceful fallback
  • just pushed iOS 3 down a level
  • looking at webdriver to generate PDFs for visual check

tying it together

  • showcase every two weeks
    • include other departments
    • no roadmap items, just value added in the last two weeks
  • focus on what your customers say, not what the industry says is cool
    • apps vs web — choose from your own analytics
    • e.g. for travel, 3x more likely to book on web
  • stats:
    • seen 10% month on month growth in Android, compared to iOS
  • ensure product always gives tech team 20% tech debt time

Replacing the Android emulator

Daniel Fages, Genymobile

http://androvm.org/

  • built on top of android-x86
  • has an emulated WiredSSID wi-fi connection
  • can use OpenGL 2.0 using hardware
    • works really well - can emulate Angry Birds
  • just added injecting sensors from attached Android device (accelerometer, etc)
  • currently working on management tool and other features
  • looking for feedback on next features
    • network
  • also can install VM on other people’s machines without having to worry about SDK
  • will be working to integrate with Jenkins
    • could be great for creating a snapshot when something goes wrong
  • not working:
    • multitouch
    • NFC, Bluetooth
    • GSM pieces: SMS & voice

Developing accessible apps for Android

Gary Readfern-Grey, RNIB

  • many people are relying on apps as the only way to do crucial things in life
  • talkback comes with Jelly Bean
  • problem:
    • icon-based buttons don’t have proper audio labels (“icon 39”, “icon 19”) so can’t find what is on the screen
    • watch out for “jump back button button
  • accessibility came in on Donut 1.6
    • relied on physical keyboard and trackball
    • touching the screen behaved as normal and gave no feedback
  • Talkback and Eyes-free-keyboard added more recently
    • eyes-free added in Gingerbread
  • ICS brought in explore-by-touch
  • Jelly Bean brings in gestures:
    • moving focus
    • back, home, recent apps
    • notification shade
  • WebView is harder
    • Jelly Bean & ICS have an additional “allow web accessibility” checkbox

testing your app

  • download talkback from google play
    • Jelly Bean has it installed (at least on Nexus 7)
    • settings / accessibility / turn on Talkback
  • check that views are focusable and have content descriptions
  • custom views need hover events

documentation

  • Google I/O 2012 making android apps accessible on youtube
  • developer.android.com: making applications accessible
  • android 4.1 accessibility APIs

top things to do:

  • add content descriptions to your widget
    • can do in XML layout using android:contentDescription attribute
    • or use setContentDescription
    • latest linter should check for this
  • make sure you can get to all elements of the app through a keyboard
    • will also help for Google TV
  • don’t depend on colour alone…
    • e.g. “correct the field that’s coloured red”
  • test it! try out Talkback
  • RNIB Innovation can help you
    • RNIB offer paid consultancy
    • if they’re doing something that RNIB really want and aren’t in a position to pay, then they could offer free help too
    • innovation@rnib.org.uk

Droidcon London 2012, Day One

The first day of Droidcon London was a barcamp, though one with lots of pre-prepared presentations.

The main highlights for me were finding out about useful libraries and services developed by the Android community — RoboSpice, TestDroid and Dr. Power — that and meeting more Android developers (apparently there were over 1000 there!).

immersion haptics

  • haptic effect preview app available on google play
  • immersion started with game controllers
    • e.g. logitech steering wheels
  • also have automotive
  • android just has vibrate on and off
  • immersion sdk extends the vibrate method
  • http://immersion.com/haptic/sdk
    • adds about 400Kb to app…
  • deals with all different vibration methods
  • copes with devices with no motors (just doesn’t do anything…)
  • best tweet about haptics @hapticsdev wins a galaxy note 2
  • navigation queues
  • battery usage — about 3% for an hour of vibrate usage during a game
    • goes down to 1% for piezo vibrators
  • but don’t use the motor the whole time — it just annoys the user and dulls their senses
  • leave the haptics and sound options separate (so people can play silently but keep haptics)
  • standardisation of patterns for accessibility?
    • library of 124 effects is a default standard
    • up to RNIB to come up with semantics

robospice

  • library for making async network requests easy
  • https://github.com/octo-online/robospice
  • intro guide
  • available on maven central
  • AsyncTasks not so useful as the activity can change while the task is still processing
    • e.g. if device rotates while running, then asynctask could update the wrong activity
    • leads to memory leaks
  • Loaders are an alternative
    • but designed for database access not networking
    • can’t keep the response if the activity changes
    • no exception handling by default
  • RoboSpice uses a background service
    • activity creates a request and a request listener
    • request passed across to the service by the spice manager
    • requests can last beyond a single activity, so can pass results to the newly rotated activity
  • each context that needs a remote call will have its own SpiceManager, each of which binds to the SpiceService individually
    • can have a SpiceManager in an activity, a service, a fragment, etc
  • SpiceService keeps results in a cache so can respond immediately
  • integrates with Spring RestTemplate for Android

text layout for localisation

By Kotikan, developers of SkyScanner

Charles & Robert@charlessharley

  • different languages have radically different word lengths for the same concept
  • best solution is to guide your translators to use shorter text lengths
  • sometimes not possible…
  • built-in truncation only operates on the whole string — can skip out important words or syllables
  • created custom TextViews
    • resizes text to fit (keeps on getting smaller)
    • flexible truncation using markup
  • code currently not available as open-source, though Charles & Robert trying to persuade their company that this would be a good idea…

resizing to fit

  • need to separately subclass TextView, Button & CheckedTextView
    • put resizing logic into a common utility class
    • decreases size (down to minimum) until fits
  • also have harmonisation to keep consistent text size amongst similar widgets
    • have a harmoniser that listens to text size changes across a group of widgets
    • sets text size of all to smallest of group
  • also used XML group ID to define harmonising groups in layout
    • include a new namespace
    • defined as res-auto so will be populated with package name
    • can be used to add additional attributes
    • key needs to be group ID and context so that XML files across the activity can be grouped together
      • context must be declared as a weak reference to avoid memory leak

flexible truncation

  • check need to truncate first
  • then parse markup to split sections
  • measuring each section
  • truncate sections to fit space available
  • cache text panes

KirinJS

James Hugman @jhugman http://bit.ly/kirin-github

  • most apps James has written are fairly IO bound
    • so performs fine for them
    • obviously, games would not be suitable
  • Glasto 2011 app stored JSON data into SQLite
  • other similar approaches:
    • Calatrava — similar to Kirin but from a web dev point of view
    • j2objc — compile java into Objective-C
      • under heavy development…
    • Ejecta.js — write to canvas, renders in OpenGL

Sony SmartWatch

Jerker Lindgren Götsten jerker.lindgren.gotsten@sonymobile.com

SDK available at http://sonymobile.com/developer (also available as ADT extensions)

  • notification & control APIs are shared with SmartWatch + Smart Wireless Headset
  • notification is stateful, with a central database on the phone
  • battery life is an issue — watch can last less than a day if over-used…
  • also frame rate is 6-7 FPS for full screen images
    • faster for partial updates
  • extensions can be started either by an app on the phone, or by the user on the watch
  • you get a Pause event if a high priority input happens (e.g. phone call)
  • SDK has utility classes to receive sensor events or send updates
  • music player also available as open source
  • host app searches Google Play looking for extensions that include LiveWare… phrases
  • sports apps are working really well in Google Play
  • other apps:
    • remote camera viewfinder
    • tic tac toe, puzzle
  • popular in Japan — with other small technologies :-)

OpenCV for Android

Erik Hellman

  • Android library is a wrapper on top of native API
    • includes armv5, armv7 and x86 variants
  • object detection
    • face, hand, eyes, edges
  • optical flow lets you track points in a moving video
  • lots of alternative classifiers available (search online)
    • haar cascade is a little bit slower than lbpcascade
  • in Android, front facing camera is 1, main is 0
  • better to work with smaller preview window size
    • 320x480 is often enough
  • faster to reuse bitmaps & matrices (avoids lots of allocations)

New Samsung developments

Manfred Bortenschlager http://developer.samsung.com

  • planning to have Samsung apps on fridges, washing machines, air conditioners as well as phones and cameras

galaxy camera

  • 21X optical zoom
  • Android 4.1,
  • basically a Galaxy S3 with a camera attached!
    • still has 3G and Wi-Fi
    • feels fairly hefty for a compact camera
  • software control gives you additional camera features:
    • automatic zoom to moving object
    • zoom while taking picture (for effect)
    • slow sync to enable light writing
    • voice control
  • current API (work in progress):
    • ParametersEx class with 130 methods…
    • setAperture, setShutterSpeed, setIso, etc
  • sample usage: camera = Camera.open() params = new ParametersEx(mCamera) params.set... params.updateParameters()

Stella SDK

ChatON & AllShare

  • ChatON: online chat
  • AllShare: online media storage & sharing

Big Fat Soft-Key

Giovanni Bisutti http://inputdynamics.com/

  • using microphone & accelerometer to detect taps on phone case
  • works on back or front of phone
  • expect SDK to be released next year
  • uses up to 7% of CPU when in use… (though more optimisation required)
  • new app being demoed next month
    • mostly native code
  • looking for an Android developer to help develop the SDK…

Future of Android - OUYA Game Console

Julie Hurman @jhurman

http://ouya.tv/

  • made $8.5m on kickstarter… ($1m in 8h22m!)
  • disrupting a market that hasn’t changed in 30 years
    • consoles and games are both expensive to purchase
  • OUYA is about openness for both gamers and developers
    • all games will be free to try
    • developers build for Android (no cost for SDK)
    • every single OUYA is a debug console
  • working with NVIDIA to have best Tegra3 performance
  • will have its own storefront
    • will curate content (review for copyright infringement, spyware, etc)
    • will not have ads
  • schedule
    • first units are coming off the production line
    • dev units will be out in December
    • kickstarter backers will receive units in March
    • aiming for full roll-out in April
  • goal is to potentially refresh OUYA on a yearly basis
    • won’t have a 6-7 year lifecycle of existing consoles
    • some of the audience were concerned about whether a stock NVIDIA chip would be able to have an impact in the living room when facing custom hardware from the likes of Sony. But as John Carmack has said, “technology doesn’t hold back game designers anymore.”
  • store will have cryptographic controls for securing content, but they’re working to allow root access to the device as well (could be interesting)
  • will be able to show the games that have had most time played in them
  • going for 70/30 revenue share
  • majority of SDK is in-app payment API

Demo Camp

This was lots of very short (1 or 2min) product demos. Some better than others…

  • testdroid app crawler
  • palerta — private social smart friend alerter
    • doesn’t overshare your location
    • by Little Fluffy Toys
    • also make location library
  • Tawkon - Dr. Power
    • can see power usage on individual processes of each app
  • secret.dj
    • 300 venues
    • see what’s playing & add to playlist
    • gamification to gain credits & jump queue