Links on Android Authority may earn us a commission. Learn more.
Android Q introduces several new APIs
The first preview of Android Q is here, alongside all sorts of developer-speak regarding the new code underneath. Beta 1 of Android Q is available starting today for early adopters and developers, bringing plenty of new improvements with it.
While there are obviously some user-facing features in Android Q, a lot of what makes Android Q special is found underneath in the code. We’re talking about APIs, or application programming interfaces. These APIs are core to how apps work with the underlying operating system.
As you’d expect, the upcoming SDK preview includes several new APIs so developers can add even more functionality to the platform. Here’s a rundown on the new Android Q APIs you need to know about.
Neural Network API 1.2
Google wants the AI in your Android phone to be even smarter. The Neural Networks API, first released in 2017, defines some basic artificial intelligence and machine learning parameters. Google says Android Q expands to 60 new operations, such as ARGMAX, ARGMIN, and quantized LSTM with a handful of performance upgrades.
This is particularly important for hardware makers, which will be able to improve the machine learning, object detection, and image segmentation in their own apps and models. Google hopes to make the Neural Network API 1.2 a part of the TensorFlow framework. Ulimately this means, down the line, apps that run in Android Q will be more independent.
Google says this API makes it easier for apps to ascertain just how good each individual Android device is at rendering video. The API simplifies the process of identifying what device is being used, what screen size and aspect ratio it has, what frame rate it supports, and what codecs are compatible. Bottom line, video apps will better be able to provide the best-looking video playback for any given device.
Native MIDI API
This is a new API that should help Android devices talk to MIDI equipment more effectively. Some apps rely on C++ to perform their audio processing. For these apps in particular, the Native MIDI API lets them talk to MIDI devices through the NDK directly. In other words, MIDI data can be read inside an audio callback using a non-blocking reader. This reduces latency and smooths over performance. End game? Your Android phone will be more compatible with your MIDI keyboard or other audio gear.
Android Q will reduce its reliance on private APIs, says Google. Private APIs are generally available only to specific, approved organizations or developers. It would be akin to Sony giving EA specific access to the PS4 that other game makers cannot reach. Google argues apps that rely on (private) APIs not included in the native SDK are at risk for crashing and security lapses. That’s why Android Q furthers the company’s effort to support only public APIs.
Google says Android Q will restrict access to non-SDK APIs over time as it asks developers to switch to public APIs. To ease developers into this transition, Google will only require apps that target Android Q (and up) to adhere to this limitation. Apps that target Android Pie and earlier will still be able to use private APIs. Google plans to add to its list of preferred public APIs based on developer feedback and requests. When a corresponding public API is not available, Google will work with individual developers to find a compromise.
In the vein of public developer testing, Google wants developers to test their apps against a wider range of non-SDK interfaces. It suggests devs use the StrictMode method to ascertain when a non-SDK API is being used. This is a long-game notion that should help developers future-proof their apps down the road.
In keeping with prior releases, Google will enforce API targeting as Android Q’s development proceeds. This means Google will force developers to update their apps for newer and newer builds of Android.
Newer versions of Android are generally more secure and more powerful. That’s why later this year Google Play will require apps to target SdkVersion 28 (Android 9 Pie). In other words, by mid-year, developers creating brand new apps or updates to existing apps will need to ensure compatibility with Android 9 Pie at a minimum, if not Android Q. Moreover, Google will start warning users when the apps on their phone target older and obsolete versions of Android.
Last, developers need to prepare their apps for the 64-bit conversion. Right now, Android supports 32-bit and 64-bit apps, but that will soon change. Later this year all apps will need to support 64-bits. This will be particularly important for apps that use the native Android SDK.
Get started with Android Q
So that sums up some of the new APIs heading to Android Q. Want to give Android Q a try? Those registered with the Android developer program can download the new Android Q preview and the associated SDKs and Android Studio.
As Google works on the fledgling platform, Android Q’s powers will only improve. While it may be exciting for the public to jump on the pre-release build, it’s more important for developers to get started with the new APIs and learn the under-the-hood changes that will have a bigger impact down the road.
Android Authority will keep you up-to-date on all things Android Q as the new OS processes. More information will be available come Google I/O in May.
Read more: Here’s how to install Android Q Beta 1