Tuesday, January 21, 2020

Android 11 will introduce a new “App Compatibility” Developer Option to help devs test new platform changes

Every year at Google I/O, Google highlights some of the most exciting changes coming to the next version of Android. While most users judge Android versions by the visual changes that affect their experience, each Android update also comes with a ton of changes to APIs and platform behavior. These changes are important for app developers to take note of and to prepare their apps for, as they can fundamentally alter the ways in which their apps can be consumed by end-users. With the next version of Android, Android 11, Google will make it easier for developers to test and prepare their apps for upcoming changes with a new “App Compatibility” setting in Developer Options.

Every time Google releases a new Android version, app developers who are interested in actively maintaining their applications need to read up on the new changes and the documentation that comes along for these changes. They can then decide to update their app to add these new API features if they want to or migrate their use of existing APIs to newer APIs, a path that may or may not be optional. App developers don’t have to update the target API of their apps immediately, but they do have to do it eventually to meet the shifting target API requirements of the Google Play Store. After this, developers also need to actually test their app on the new Android version, and this can be done on an emulated device, a cloud-hosted device, or a local device. Testing is part of the development routine, but testing becomes even more important when there are major changes involved.

Further, when Google wants to introduce major platform behavior changes, they don’t immediately implement the change in the new Android version release. This is to protect users from having a lot of their apps breaking and losing functionality, and it also gives developers more time to update their apps. For example, in Android 7 Nougat, Google decided to limit some implicit broadcasts in order to save battery life. With Android 8 Oreo, Google completely restricted apps from registering implicit broadcast receivers. But before Android 8 Oreo was released, Google wanted developers to prepare for a scenario where their apps would no longer be able to register implicit broadcast receivers. And for this, developers could use an ADB command in Android 7 Nougat to simulate a condition where implicit broadcasts are unavailable:

adb shell cmd appops set RUN_IN_BACKGROUND ignore

ADB commands such as the one above are an example of how Google allows app developers to test how their apps would behave under Android platform behavior changes.

Another recent example is how in Android Q Beta 2, Google asked developers to test Scoped Storage on their apps by running this ADB command:

adb shell cmd appops set your-package-name android:legacy_storage default && \

As an app developer, one can presume that you are comfortable with ADB commands and aren’t particularly averse to using them to test out these platform changes. But there is always room for improvement, and Google is making this testing process easier by introducing a simple UI to control these changes.

With the new PlatformCompat project, developers no longer need to run ADB commands for each and every new platform behavior change. With Android 11, Android will have a new submenu within Developer Options to quickly toggle new platform behavior changes on a per-app basis, without needing to send any ADB shell commands. There will be different sections for each target API level — for example, API level > 29 will have its own set of behavior changes that can be toggled, while API level > 30 will have its own set of changes.

Android 11 App Compatibility Changes

In the screenshot above showcasing the App Compatibility section (from a source-built AOSP running on an emulator), the “Default Enabled Changes” section includes Android 11 API changes that will be enabled by default on all apps regardless of their target SDK. The section “enabled for targetSDKversion > 29” are Android 11 API changes that are enabled only for apps that are targetting Android 11/API level 30.

While this particular change will not directly excite end-users, it does make the job of app developers easier, and that’s always a good thing.


Thanks to XDA Recognized Developer luca020400 for the tip and for providing the attached screenshot.

Further coverage on Android 11:

The post Android 11 will introduce a new “App Compatibility” Developer Option to help devs test new platform changes appeared first on xda-developers.



from xda-developers https://ift.tt/369hyji
via IFTTT

No comments:

Post a Comment