DroidCon UK 2015 day 1

9.00 Keynote: The long road
Speaker: Sandro Mancuso

Inspirational talk about how to find the job that will be the next step in your career.
Your personal career goals can be very different from a career within a company.

10.30 RxJava – Get Reactive
Speakers: Pascal Welsch and Wolfram Rittmeyer

RxJava
Beware of backpressure (items emitted too fast) discussed on Wiki as well. Possible solutions:

  • Throttle
  • Buffer
  • Request(n) upstream items

Testing: Use TestSubscriber.

RxAndroid
RxJava bindings for Android.

RxBinding
RxJava binding APIs for Android’s UI widgets.

Type and make network request handling, i.e. type and search. Add the following:

  • .throttleLast(100, MS) – Emit the most recent items emitted by an Observable within periodic time intervals.
  • .debounce(200, MS) – Only emit an item from the source Observable after a particular timespan has passed without the Observable emitting any other items.
  • .onBackPressureLatest() – Is there are still too many, take latest input.

RxLifecycle
Lifecycle handling APIs for Android apps using RxJava.

Other recommendations

  • Mosby – A Model-View-Presenter library for modern Android apps.
  • Nucleus – Nucleus is a simple Android library, which utilizes the Model-View-Presenter pattern to properly connect background tasks with visual parts of an application.

11.30 Gradle (performance)
Speaker: Etienne Studer

Gradle is more than just building. It can also be used for releasing, documentation, etc.

  1. gradle build --rerun-tasks

Rerun tasks even if they are up to date.

Performance improvements:

  • Incremental build feature. Define inputs and outputs for custom tasks.
  • Continuous build feature, faster compilation.
  1. gradle test -t

(Relies on inputs and outputs being defined.)

MOOC: Gradle for Android and Java.

12.30 Land’s End: Creating the flagship mobile VR adventure
Speaker: Peter Pashley

Getting started: Install Unity! and the Oculus SDK.

Nausea

  • Frame rate
  • Texture
  • Don’t highlight lack of positional tracking (Don’t put objects close to user so they won’t try to step / look around it.)
  • Acceleration is bad!

Input

  • Gamepad (Reminds user of the world they are not in.)
  • Gear VR
  • “Gaze” (Look points)

Things that didn’t work

  • Moving things on rails or predefined paths. Limits the user’s freedom.
  • Buttons. Too easy, too little player reward.
  • Unconstrained exploration. Take a wrong route, takes a long time to get back.
  • Path hinting. Focus becomes on following the path and not exploring.
  • Levitating huge objects. Obstructs points of reference and makes players motion sick.

Lookpoints

  • Focussing, aim and hold.
  • Motion, knowing where you’re going to stop moving.
  • Placement, not too many near each other.

14.15 ClassyShark Attack
Speaker: Boris Farber

Fast decompiling/debugging for Android APKs.

Ctrl + s – Save Java file.

Supports 5 binary formats

  • Jar
  • Dex
  • APK
  • Manifest
  • Java class

Project site: https://github.com/googlesamples/android-classyshark

15.15 $N tips for building better apps.
Speaker: Wojtek Kalicinski

Stop running your code
Don’t cram too much into Application.onCreate(). ContentProviders and BroadcastReceivers can cause the method to be invoked.
Solutions:

  • Defer work, lazy load.
  • Stop Services.
  • Disable BroadcastReceivers.

Permissions

  • Use ContentProviders to share files and/or get rid of permissions.
  • Use Intents to get rid of even more.
  • Runtime permissions. <uses-permission-sdk23>
  • AccountPicker.newChooseAccountIntent()

Low memory devices
ActivityManager.isLowRamDevice(), available in M, use

  1. android:extractNativeLibs="false"

Native library cannot be compressed and need to be zipaligned (zipalign -p). Write a small bash script to repackage .so when APK is built.

Accessibility
Accessibility is important, you get a bonus for it.

  • Settings > Accessibility -> Talkback
  • Add android:contentDescription tags. Set it to something meaningful. (For decorative elements, set to @null.)
  • onTouchListener, don’t insert click logic, use View.performClick()

Bonus: No extra work when integrating with the accessibility assistent.

16.15 Democamp Community Demos

  • Lumi Social News – Tinder for news.
  • SendTo – Send messages, text, links, etc to your own devices.
  • Myntra – Fashion / Shopping app. Preloading content for fast user experience.
  • Infinity Loop – Game
  • Sharp SVG lib
  • Lunchbreak (Belgium only) – Order lunch online
  • UI testing in your browser – ??
  • Frisbee GDG – All GDG content in one place.

17.15 Keynote: Managing Expectations: A Manager’s Guide for Managing to Manage Unmanageable Teams Manageably
Speaker: Chet Haase

Hilarious talk about management.

Other

  • Lands of Ruin – Lands of Ruin is a tabletop game where tablets replace classic rulebooks, character cards, stat sheets, and pen-and-paper calculations.
  • Land’s End – Mobile VR game.
  • Vysor – Lets you view and control your Android on your computer. Easy peasy.

Droidcon UK – day 2

9.00 What’s new in Android

Company: Google, Speaker: Chet Haase

New Nexus 6 and 9 devices. Android Studio 1.0 Beta.

Material design: Tangible surface, easy ways of branding, meaningful motion, adaptive design. Also see the design documentation.

UI toolkit: New theme (material), theme colours (all assets are greyscale and can be tinted), dynamic colors (pallet API). New (material) widgets: RecyclerView, (Stacker)GridView, CardView.

Graphics: Real-time shadows relative to light source (60fps), outlines for Views. Render thread.

Material animations: Activity and Fragment transitions. Animation curves. Animated reveal. Animated vector Drawable.

System changes: Document-centric apps, new (material) Notifications, heads-up Notifications. Notifications on lock-screen.

Media: OpenGL ES 3.0, Android extension pack, Camera & Audio: raw input, MediaSession, MediaBrowser.

ART is now the runtime for L.

Project Volta: optimising battery usage. New service: BatteryStats. Use Historian (on Github) to analyse results.

10.00 Papercraft

Company: Google, Speakers: Chris Banes, Nick Butcher, Slides on G+.

Reasons behind Material Design:

  • Providing a coherent cross-platform experience.
  • A more flexible design system for Android.
  • A rational approach to visual, interaction and motion design.

Tangible surfaces
UI as digital paper. Adding z-depth, signifying UI element importance.

Z = Elevation + TranslationZ.
New “stateListAnimator” XML-attribute.

Extend the ViewOutlineProvider class to create any clipping.

Print-like design
Refined typography, using typography to provide the app structure. Typographic scale provides the standard scales.
There is a new TextAppearance.AppCompat style.

Using bold colours, take the brand colour and use the complementary as accent.
Styling using:

  • colorPrimary
  • colorPrimaryDark
  • colorAccent

Theme.AppCompat provides the tinting as well (API 7+).

Content can provide colours. To generate the colours, use the Palette class:

  1. Palette.generate(bitmap)

The palette generation takes roughly 30ms, so run it on a separate thread.

Meaningful motion
To enable Activity transitions, add “android:windowContentTranstion” attribute to your theme. Next, Define a shared element. And finally, start the Activity.

Asymmetric motion, user initiates motion. To create this, use the RippleDrawable (“ripple” XML-tag).
Circular Reveal, use ViewAminationUtils.createCircularReveal(…).

Adaptive design
Making apps looks good on various screen sizes.
Think in Keylines, Increments, blocks.

New more flexible Toolbar (based off Actionbar).
Add “Toolbar” XML-tag in your layouts. Also available in AppCompat.

12.00 How to Build a One Man Band

Speaker: Nicoll Hunt

You’ll need: Time, money, skillz.

Stop wasting time on unrelated things. Use self-funding and/or crowd funding (like kickstarter). Work with your limitations, accept them, don’t try to fight them. Learn to deal with criticism.

13.45 Graphical Magic – Styling Android

Speaker: Mark Allison, Blog: blog.stylingandroid.com

Increasing performance by reducing GPU overdraw. Turn “GPU Overdraw” on in device developer settings to see trouble areas. Flatten any Views with transparent backgrounds. Hook into the “onPreDraw” method.

Use the ColorMatrix class to manipulate colour information. Use a paint Shader to apply effects on text, the same way you can create outlines (a.k.a image masks).

Applying blur effects with RenderScript. To avoid artefacts, add a margin and crop it off later.

Don’t forget to recycle() any temp Bitmaps.

14.35 Rx-Fy all the things!

Company: Novoda, Speaker: Benjamin Augustin

Reactive Extensions Java project: RxJava on Github.

Important Operators/methods to remember:

  • map
  • flatMap
  • onErrorResumeNext()

To perform multiple operations / create a pipeline, chain multiple of the above Operators.

Novoda working on a set of RxJava tools for Android.

RxAndroid – Collection of tools for Android created by SoundCloud.

For a quick intro into RxJava, have a look at the RxJava workshop in the Novoda workshops repo.

15.45 “Project Volta”
Or “Getting By With Less Than 1.21 Gigawatts”

Company: Commonsware, Speaker: Mark Murphy

Discussing the new JobScheduler class. All slides can be found at commonsware.com/presos/droidconUK2014.

BatteryHistorian is a python script hosted on the Google Github.

16.35 Deep Dive into the Gradle-based Android Build System

Company: Gradleware, Speaker: Etienne Studer

The Gradle DSL configuration is mapped to the AppExtension object.

When creating your own tasks, make sure to define inputs and outputs so the task can be skipped when there is no change.

Enable Gradle daemon on your local machine to cut down VM warm-up times.

17.30 Closing Ceremony

Droidcon UK – Day 1

9.00 Barcamp planning

Getting all sessions in for the day’s talks. At the end of the day there will also be an “Appcamp” to demo applications to the audience.

10.30 AIDE – Android Wear app with AIDE

Company: appfour GmbH, Speakers: Hans Kratz, Dr. Dennis Strein, Website: www.android-ide.com.

AIDE = Android Integrated Development Environment.

Applications that are “Wear enabled” contain the Wear APK inside the phone APK.

AIDE uses Gradle to package Wear. To enable Wear, add the following to your build dependencies:

  1. wearApp project(':wearable')

Google also has a lot of information on how to create wearable apps.

The presentation was followed by a live demo of how to use AIDE on a device.

11.10 Modern Testing Technologies

(or how to avoid getting murdered in your sleep by a death goblin.)

Speaker: Mr Death Goblin a.k.a. Zan Markan

Follow SOLID principles to increase your chances to catch a goblin.

Good tools for this include: Dagger (DI/IoC), Mockito (mocking), Calabash, Robotium, etc. Start using the tools before you write a single line of code.

When your project grows, allow for refactoring. Split up too big methods, classes, etc. The tests should be there to help you achieve that and keep things working.

Use CI tools, like Travis, to automatically test / build your project.

How to deal with legacy projects? Start by covering new features with tests. Cover any code related to bug fixing with tests. Little by little the coverage will get better and better.

12.05 TDD Coverage

Tools: GUnit (Unit tests), Robolectric, Mockito (Mocking), Emma (for coverage).

Performance testing with a monkey that visits every Activity, combine this with TraceView for profiling to measure memory usage, CPU, etc.

Testing the manifest: Use Robolectric to get a shadow application, fetch the package manager, check what service, receivers, etc are registered and verify that they exist.

12.45 Simple persistence with cupboard

Company: LittleRobots, Speaker: Hugo Visser, Project home: bitbucket.org/qbusict/cupboard

SQLite powered, using field names (from Models) to match columns. Simple usage example 

  1. cupboard().withDatabase(db).put(person)

14.20 Calligraphy – Fonts in styling

Company: YoYo, Speaker: Chris Jenkins, Project home: github.com/chrisjenx/Calligraphy

Simplifying using custom fonts on Android.

Example usage:

  1. <TextView ... fontPath="fonts/your_font.ttf">

15.55 Y U No craftsman!?

Company: Novoda, Speakers: Paul Blundell and Xavi Rieau

Ways to create better code / be a better craftsman.

Pair programming, best coding practices, code reviews. Care about CI, show build status (i.e. on a big screen in the office). Run static analysis reports. Test!

To make things more fun: CI Game (Jenkins plugin), creates a monthly leaderboard.

Use the latest tools with your work.

Be “agile”, build features the way they make sense. Believe in YAGNI (you ain’t gonna need it), don’t over-engineer.

Make your app awesome:

  • Get off the main thread.
  • Use Strict Mode (both in code and dev options).
  • Use “GPU Profiling” (under dev options).
  • Use “Show Overdraw”
  • Polish the app. (Lots of tips in the Android docs.)
  • Animate all the things.
  • Listen to (user) feedback.
  • Measure the data.
  • Follow the guidelines.
  • Add debug screen(s) for QA and yourself.
  • Proper versioning.
  • Hexagonal architecture.

16.30 Democamp

Showcasing the following applications

  • SkyScanner
  • DoneDeal
  • VelociCaptor
  • ???
  • Clue
  • See Speak
  • Hey Order
  • Islamic prayer times
  • Kites
  • Stay.com
  • ???
  • E-reader Open Source app

17.30 Practicing Practical Best Practices – for Software Development Practitioners

Company: Google, Speaker: Chet Haase – Process Methodologist

“Practices Make Perfection”

Traditional best practices: Code comments, Naming conventions, Simplicity, Portability. Continuous Integration, Testing, Process.

Laws of software quality:

  1. errors = (more code)^2 = e = mc^2
  2. The more bugs, the less quality.

The path to better quality software: higher quality, less bugs, fewer code.

Fast, user-friendly and power-efficient network communication on Android

Notes from Erik Hellman’s talk about “Fast, user-friendly and power-efficient network communication on Android” on the second day of DroidCon UK 2012.

Doing network communication the right way isn’t all that hard, just keep a couple of recommendations in mind. There is no need to “re-invent the wheel”, other fields have struggled with this problem before, we can learn from them. There are also a lot of open source projects that tackle various network related problems, quite often one of those will meet your requirements.

That being said, handling the network on a mobile phone can be difficult. The connection can drop out of nowhere, the quality can change or you might not even be online at all. There are a couple of things that developers can do to make the experience better:

  •  HTTP Client handling
  • Background network I/O
  • Playing server

Generally speaking HttpUrlConnection is the best client to use, except for Eclair and Froyo, for these API versions the Apache HTTP client has fewer bugs.
Make sure to wrap the HttpUrlConnection streams in buffers and always exhaust the streams.

Enable caching, it will save a lot of network traffic.

To avoid blocking the UI thread, always run your network related tasks on a different thread using a Service with a Handler implementation.
If you need to poll a URL on a regular basis, use the AlarmManager to schedule requests at a set (slightly inexact) interval.

An Android device could also serve as a server (think multiplayer gaming). This could be quite complex to create, but luckily the Netty.io library will probably meet most of your needs.

And lastly, don’t use a splash-screen, there should be no need for it. Give the user as much control as possible.

You can watch the full presentation on the Droidcon UK website or read it in pdf format on Sony’s site.

Device Fragmentation by Robin Puthli

Notes from Robin Puthli’s talk about Device Fragmentation among Android devices on the 1st day of DroidCon UK 2012.

Device fragmentation starts to become a big part of Android development as there are more and more Android devices available. As a result there are a lot of different resolutions and screen sizes that need to be taken into account. OpenSignal.com has a very interesting report on their blog that illustrates this fragmentation.

Luckily (device) fragmentation is a very old problem. It had to be solved on operation systems (Window, Mac, Linux, etc), browsers (Chrome, FireFox, Internet Explorer, etc), Java (ME, SE, FX, etc) and more before.

There are roughly nine strategies you can pick from to deal with device fragmentation.
Multi-manual: Phone vs tablet, writing separate code for each.
Derive multi: QT or J2ME Polish, Mono Touch, writing pseudo code and then letting the framework generate the rest.
One (size) fits all: HTML5, PhoneGap. This approach is based on coding for the lowest common denominator.
Single adapt
: Writing adaptive layouts, using 9-patches, fragments.

“There is no silver bullet. You have to pick and mix [from the available solutions].”

The full presentation can be found at Itude Mobile’s blog.

OpenCV for Android by Erik Hellman

Notes from Erik Hellman’s talk about OpenCV for Android on the 1st day of DroidCon UK 2012.

Open source Computer Vision library, containing loads of modules and image (related) algorithms.

The code is very well documented, but most samples are in C++.

A couple of examples of what you can do with OpenCV are:

  • Object detection, i.e. face detection.
  • Salient feature detection, i.e. hand or a door frame.
  • Motion tracking.

The talk mainly covered demonstrations of what you can do with OpenCV, rather than going into more detail.

Library: Download OpenCV (for Android)
Documentation:  OpenCV API Reference

AllJoyn by Mitch Williams

Notes from Mitch Williams’ talk about AllJoyn on the 1st day of DroidCon UK 2012.

“AllJoyn™ is an open-source application development framework that enables ad hoc, proximity-based device-to-device communication that is OS agnostic.”

There are other frameworks like DLNA, UPnP and Bonjour as well. DLNA would be a good choice if you only wanted to do one-to-one device communication. UPnP and Bonjour are missing a lot of the higher level communication compared to AllJoyn.

AllJoyn is multi-platform as a result of the native implementation being written in C++. The currently supported platforms are:

  • Android 2.1 and above
  • iOS
  • Window XP, 7 and 8
  • Linux
  • OS X

Source code: AllJoyn @ Github.
Documentation: AllJoyn Java docs.

Introduction to Polaris by Cyril Mottier

Notes from Cyril Mottier’s talk about Polaris on the 1st day of DroidCon UK 2012.

Polaris is a mapping library for Android. It was created because with the current Google Maps API it is painful to even do simple stuff.

Some features of Polaris include:

Gesture support

  • Simple tap (opens a call out)
  • Double tap (zoom in or zoom to the maximum zoom level for the location)
  • Long press

(Map) Annotations with a “variable anchor” (the arrow/pointer of the annotation is dynamically placed based on the location’s position on screen).

Demo: Polaris Sample @ Google Play Store.
Source code: Polaris @ Github.

NOTE: Polaris may become obsolete as Google is working on a new Maps API for Android.

DroidCon UK – day 2

Another quick summary of the talks of the day.

9.45 The Fragment transition
Who: Corey Leigh Latislaw
What: Introduction on using Fragments.
Web:
Summary: Start using Fragments now. There is no need to convert a whole app at once, but you can start using Fragments with the new Activities you are building.

10.30 Writing games for an Android console.
Who: All Sutton – Ouya
What: Some considerations to keep in mind when developing for a console.
Web: www.funkyandroid.com
Summary: Developing for a console is wildly different from mobile.

11.30 Android reverse engineering
Who: David Tellebaum – apkudo
What: Reverse engineering Android applications.
Web: www.apkudo.com
Summary: Hacking Zynga’s “Words With Friends” using (bak)smali and ViewServer.

12.15 Interfacing hardware with Android and Arduino
Who: Fei Manheche – Robobo
What: Connecting Android apps to Arduino hardware.
Web: www.robobo.org
Summary: A brief introduction on how to make Android and Arduino talk to each other.

14.00 Memory Analyzer
Who: Felipe Ferraz – CESAR
What: Memory analyzing to resolve bugs and optimize performance.
Web:
Summary: Using a timeline of memory dumps and the MAT Eclipse plugin to resolve bugs and optimize performance.

14.45 Deep dive into Android custom components
Who: Chui-Ki Chan – Monkey Write
What: Creating your own custom components.
Web: www.sqisland.com
Summary: Easily create your own custom components by either encapsulating or extending existing widgets. Slides: www.bit.ly/DeepDiveComp

15.45 Optimized network communication
Who: Erik Hellman – Sony Mobile
What: How to optimize your networking logic to provide user-friendly and power-efficient experiences.
Web:
Summary: A set of tips and best practices to avoid annoying the user and not drain the battery with networking activities.

16.30 Dynamic Animations
Who: Anders Ericsson – jayway.com
What: Dynamic animations.
Web: www.jayway.com
Summary: By extending a View, adding a custom class to calculate position (using spring and damper physics) and using a Runnable you can quickly add animations to any View.

17.15 AndroVM
Who: Daniel Fages – Genymobile
What: An Android VM that runs on VirtualBox.
Web: www.androvm.com
Summary: An explanation about how AndroVM is built followed by a demo.

18.00 Developing accessible applications
Who: Gary Readfern-Gray – RNIB
What: Developing accessible applications for Android.
Web: www.rnib.org.uk
Summary: It takes very little effort to add basic accessibility optimizations by using content descriptions for widgets and making the app navigable by keyboard (or at least D-pad).

DroidCon UK – day 1

A quick summary of the talks of the day.

10.05 AllJoyn
Who: Mitch Williams – Qualcomm
What: AllJoyn P2P framework
Web: www.alljoyn.org, www.alljoynappchallenge.com
Summary: An ad-hoc and proximity based p2p framework.

10.40 Device fragmentation
Who: Robin Puthli – Itude Mobile
What: Mobile device fragmentation
Web: www.itude.com
Summary: Fragmentation is an old problem. “There is no silver bullet. You have to pick and mix [from the available solutions].”

11.15 Unify VoIP / MSG Core
Who: Martyn Davis – Voxygen
What: Unify VoIP / MSG Core
Web: www.voxygen.co.uk
Summary: A paid for VoIP library written in C, using JSON messaging. Available for Android and iOS.

11.50 Polaris
Who: Cyril Mottier – Prixing
What: An introduction to Polaris
Web: www.github.com/cyrilmottier/Polaris
Summary: A (Google) maps library for Android. Adding a lot of useful features.

13.25 Gradle
Who: Lukas Jarosh – And labs ?
What: Gradle
Web:
Summary: Gradle, a less verbose Maven alternative.

14.30 OpenCV
Who: Eric – Sony
What: OpenCV library
Web: www.opencv.org
Summary: Open source Computer Vision library, containing loads of modules and image (related) algorithms.