Google I/O 2019: What’s New For Developers
- Behold: Android Q
- Scoped Storage
- Location Permission
- Developer Productivity
- Non-Kotlin Developers
- Jetpack Libraries
- Jetpack Compose
- Android Studio Improvements
- In-App Updates
- Google Assistant
- HowTo Templates
- Improved App Actions
- Interactive Canvas
- Improving the Web
- Speeding up Web Browsing
- Optimizing Websites
- Safe and Private Browsing
- Platforms for Developers
- Machine Learning & Artificial Intelligence
- Where To Go From Here
Since Google I/O in May there has been a firehose of information about the new things Google is providing, and the updates that have come out since. Now that the whirlwind has slowed down, it feels like a great time to catch up on what’s new and what updates have come out since the event. There have been several articles about the event such as Google I/O: What’s New in Android, and here the focus will be on the entire developer community.
This year’s Google I/O brought many new introductions to the Android and web development worlds. Additionally, Google Assistant and AI gained some traction as well. Finally, the team showed a large focus on security, productivity, tooling stability and accessibility. It’s been a few months since those announcements came out, and there is surely some progress visible, so let’s dive in! :]
Behold: Android Q
With the upcoming release of Android Q, there have been many changes to the system and its behavior. Some of the key points this version is focusing on are user privacy and security. There are also a couple of smaller things developers and users should be aware of regarding these changes.
In Android Q, apps and their data will live in something called Scoped Storage. This type of storage represents a sandbox of sorts. Each app can only access its own app data directory, making the navigation through and to data much easier. As such, most apps won’t require any permissions, such as
READ_EXTERNAL_STORAGE, to manage the app data. Furthermore, this works for data you want to save in external storage. But if you still want to read files and data from other apps, for example when using file-manager applications, you need these permissions.
Additionally, if your app wants to access downloads, it can simply use the system’s Storage Access Framework, once again, without any permissions! The documentation states that as of Android Q Beta 6 you can either work with the new filtered storage or opt-out of it. If you opt-out, you’ll have to use legacy storage by adding the following attribute and code to the Android Manifest:
<manifest ... > <!-- This attribute is "false" by default on apps targeting Android Q. --> <application android:requestLegacyExternalStorage="true" ... > ... </application> </manifest>
If you choose to do so your app will use the legacy storage system even if the device updates to Android Q. You should definitely still check out and prepare for scoped storage by following the official documentation. Future releases will enforce scoped storage and require it by default!
Another really important change regarding security and privacy is the location permission change. Frankly, not much has changed here regarding development. But, if you’re rolling the latest Android Q previews you might’ve noticed how the system dialog changed! Now, the system periodically tells you that an app has been using your location in the background:
With this in mind, developers should be very transparent when it comes to using location. The user will get notifications from the system mentioning apps that have background location access. Since they can disable access to it at any time, it’s easy to lose the location permission from the user. So, unless you really need the user’s location data when the app is in the background, you should be careful when requesting it! :]
Another major concern the Google team has had for the past year or so is the question of developer productivity. Most importantly, Android has become increasingly Kotlin first. All the new Jetpack libraries reflect this, as they received first-class Kotlin support! However, you’re still writing Kotlin in another tool, Android Studio! As such, it’s also crucial to mention that Android Studio has received many new improvements, bug fixes, and optimizations. Let’s see what changed in the past few months on that front.
A great initiative by both JetBrains and Google called Kotlin/Everywhere has been one of the main focal points for both companies. The companies are striving to further improve Kotlin and Android developer communities. With that in mind, they came up with the idea of creating global community-driven events all about this amazing language and its users. In the past few months, you had the opportunity to apply as a speaker at one of the Kotlin/Everywhere events, or even to be an organizer of an event in your local community.
This has lead to several hundred events being organized with support from both Google and JetBrains. The companies support you with speakers, goodies and general organization. There’s still time to organize your own event at the official event website. This just goes to show how important Kotlin is to not only Google and the Android developer community, but also server-side, web and native development communities! :]
Supporting and using Kotlin is great, but many projects require a different kind of development. These projects require native development with C++ or have a dependency on legacy Java code. Because of that, it’s important to know that those programming languages still get a lot of love and support. Google has continued improving the support for modern Java 10 desugaring and language features and C++ 17. You can use modern features to optimize and make your code more concise, while still keeping the ability to analyze the code thoroughly.
Additionally, they are constantly updating and simplifying native development documentation to make it easier for you to use the NDK!
Not long ago, Google announced Android Jetpack. This is a series of libraries to write less code, support larger audiences, and provide more stable and backward-compatible solutions. It sounded a bit too good to be true, but Google has done nothing but deliver when it comes to Jetpack. Jetpack is constantly growing and involving more and more libraries you can use in your everyday code. This results in you having a much simpler job when it comes to working with many Android features.
One of the newer components, announced at Google I/O, is the CameraX library. It’s meant to be a simpler, cleaner, and more extensible solution for working with the Camera API on Android. Additionally, it should work across all device vendors with consistent behavior. At Google I/O you couldn’t see a lot of code around it or try to implement it in your project. Part of the reason was that the API was pretty new and in alpha stages. But now, a few months later, you can follow this cool Codelab from Google, which introduces you to the CameraX API. If you follow the Codelab you can easily integrate CameraX in your project!