The Android Dev Summit was an Android-only developer-focused conference hosted in the Computer History Museum in Mountain View. It’s much more deep dive focused that Google I/O and given the locality of Google HQ there were lots Googlers to answer questions.
All sessions videos are here.
Themes and Styling – video
There was a big emphasis on using Theme attributes (e.g `?attr/textColorSecondary`) to set your colours within our apps rather than setting the specific colours in styles/layouts. The main advantage is you can tweak or change your theme can you don’t have to change all your style definitions. The best use case was supporting day/night mode which switches the app’s colour depending on the time of day.
But also useful when changing colour scheme for a particular screen. i.e if displaying football teams, theme the screen based on team colour. In HelpScout’s case, the way we theme a screen yellow when composing a conversation note.
Also, material specs have been updated form colours point of view. Instead of colour primary, primarydark and accent. It’s now primary and secondary with variants and there’s a focus on the colour of text when it’s on light or dark background more info. Bonus Lightning talk on vector drawables from Nick Butcher.
Webviews – video
There’s a new AndroidX Webview library whose aim is to provide stability and common API across Android versions. When using
shouldOverideUrlLoading() make sure to check
WebResourceRequest.hasGesture() to ensure it’s a person clicking a link and not a script (benign or malicious) causing the URL to change.
The talk also covered a bunch of best practices when loading in-app HTML content. I’ve personally found out a lot of this the hard way but great to see these tips in official Google video.
Android Gradle Plugin – video
- Run the latest version it’s generally quicker. And use Gradle build scan or –profile –Info to profile your Gradle builds to improve speed.
- Namespace Scoping of library resources and strict resource visibility, public, private and private xml only is coming soon Android Studio 3.3 – this will affect how resource (strings/colours) are handled in SDKs.
The Android Emulator – video
Some good learnings about the improvements and internal workings of the Android emulator. Specifically, the snapshots feature where you can resume an emulator in <2 secs rather than the previous startup time of ~2mins (this is based on the last time I used the emulator 2+ years ago). Also the newer the version of Android the quicker the emulator will start.
You can also launch emulator multiple times in Read-only mode and when it shuts down the state is discarded. This sounded ideal for running instrumentation and integration tests on CI server.
Apk upload speed (and files in general) to the emulator has hugely improved in recent years. There’s a new Alpha channel for the emulator.
Notifications – video
When sending message notifications to users we should use Messaging Style and the new Person Builder as this has better support across the different version of Android (the look and feel of notifications seems to change in all the recent Android versions) and the other platforms such as wear and auto. Consider integrating with device do no distribute mode (I missed how to do this) or adding specific in-app config so your notifications can be stopped when the user wants some downtime i.e 6pm to 8am.
Tip: Check if the user has blocked your app’s notifications. Remember that in Android 9.0 the system prompts users to block notifications if they are dismissed 3 or more times without interacting. Also, it’s likely to be useful to record analytics so you know the % of users who have blocked you.
Preferences – video
Best talk title of the summit “Preferential Practices for Preferences”. New to me was that there’s a now an AndoridX – Preferences library latest release `androidx.preference 1.1.0-alpha01` . Louis talked about some of the advance preference features such as categories, splitting into sub-screens and the dependency attribute to disable sub preferences if dependant preference value isn’t true. My personal fav was a new feature in the 1.1 alpha Summary Providers that allow you to use Dynamic Summaries for your preferences and the API seemed tons nicer that the current solution if using a onPreferenceChange Listener. More info on the latest release
Single Activities -why, when, how – video
Ian spoke about more about the Navigation component and some of the rationale behind Google’s new recommendation to switch to single activity apps.
- Gives more control of the animations/ transitions between screens
- Easier lifecycle handling
Storing Files – video
Great review of the various places we have to store files on Android and the security implications of the location you choose.
- Make use of the Cache dir for image cache
- Avoid File:// urls as they are no longer supported in Android 8+
Foldables – video
The big news was confirmation of support for foldable displays! Google/Samsung will work in partnership to create a standard in Android rather than what feels more common for Samsung (and other OEMs) to just do things their own way. Pleased to see that the first official folding device will be built in/retrofitted into Android 9.0.
In terms of foldable displays, I think it’s cool tech but personally feel too early and niche to be excited or concerned about from a code change point of view. If I worked for a large company with 100+ Android devs then maybe it would be worth the investment. Also, the 1st generation devices coming next year are rumoured to be very expensive.
There’s a change to the activity lifecycle for multi-window apps/activities on these foldable devices where *all* apps/activities on screen are in resumed state rather a just the single/focused app. But this behaviour is opt-in and the device has to have a special flag to opt-in so in my mind this is not a concern yet. Although the speaker hinted at a change in behaviour from Android Q onwards.
Vault – Chatting to developers at famous US-based media company they talked about how they use a product called vault to protect secrets stored within Github repo that’s deprecated via personal access token. Sounded interesting and plan to investigate it further.