Thursday, May 23, 2024
HomeMobileEnhance your app’s availability throughout system varieties

Enhance your app’s availability throughout system varieties



Posted by Alex Vanyo – Developer Relations Engineer

TL;DR: Take away pointless characteristic necessities that forestall customers from downloading your app on units that don’t assist the options. Automate monitoring characteristic necessities and maximize app availability with badging!

Required options cut back app availability

<uses-feature> is an app manifest component that specifies whether or not your app is determined by a {hardware} or software program characteristic. By default, <uses-feature> specifies {that a} characteristic is required. To point that the characteristic is non-compulsory, you will need to add the android:required=”false” attribute.

Google Play filters which apps can be found to obtain primarily based on required options. If the person’s system doesn’t assist some {hardware} or software program characteristic, then an app that requires that characteristic gained’t be accessible for the person to obtain.

<uses-permission>, one other app manifest component, complicates issues by implicitly requiring options for permissions similar to CAMERA or BLUETOOTH (see Permissions that suggest characteristic necessities). The preliminary declared orientations on your actions may also implicitly require {hardware} options.

The system determines implicitly required options after merging all modules and dependencies, so it will not be clear to you which ones options your app in the end requires. You may not even bear in mind when the record of required options has modified. For instance, integrating a brand new dependency into your app would possibly introduce a brand new required characteristic. Or the combination would possibly request extra permissions, and the permissions might introduce new, implicitly required options.

This conduct has been round for some time, however Android has modified rather a lot through the years. Android apps now run on telephones, foldables, tablets, laptops, automobiles, TVs and watches, and these units are extra diversified than ever. Some units don’t have telephony providers, some don’t have touchscreens, some don’t have cameras.

Expectations primarily based on permissions have additionally modified. With runtime permissions, a <uses-permission> declaration within the manifest now not ensures that your app can be granted that permission. Customers can select to disclaim entry to {hardware} in favor of different methods to work together with the app. For instance, as an alternative of giving an app permission to entry the system’s location, a person might choose to at all times seek for a selected location as an alternative.

Banking apps shouldn’t require the system to have an autofocusing digital camera for verify scanning. They shouldn’t specify that the digital camera should be a entrance or rear digital camera or that the system has a digital camera in any respect! It needs to be sufficient to permit the person to add an image of a verify from one other supply.

Apps ought to assist keyboard navigation and mouse enter for accessibility and usefulness causes, so strictly requiring a {hardware} touchscreen shouldn’t be essential.

Apps ought to assist each panorama and portrait orientations, in order that they shouldn’t require that the display screen might be landscape-oriented or might be portrait-oriented. For instance, screens inbuilt to automobiles could also be in a set panorama orientation. Even when the app helps each panorama and portrait, the app might be unnecessarily requiring that the system helps being utilized in portrait, which might exclude these automobiles.

Decide your app’s required options

You need to use aapt2 to output data about your APK, together with the explicitly and implicitly required options. The logic matches how the Play Retailer filters app availability.

aapt2 dump badging <path_to_.apk>

Within the Play Console, you may also verify which units are being excluded from accessing your app.

Enhance app availability by making options non-compulsory

Most apps shouldn’t strictly require {hardware} and software program options. There are few ensures that the person will permit utilizing that characteristic within the first place, and customers anticipate to have the ability to use all elements of your app in the way in which they see match. To extend your app’s availability throughout type elements:

    • Present alternate options in case the characteristic isn’t accessible, guaranteeing your app doesn’t want the characteristic to perform.
    • Add android:required=”false” to present <uses-feature> tags to mark the characteristic as not required (or take away the tag solely if the app now not makes use of a characteristic).
    • Add the <uses-feature> tag with android:required=”false” for implicitly required characteristic as a consequence of declaring permissions that suggest characteristic necessities.

Stop regressions with CI and badging

To protect in opposition to regressions attributable to inadvertently including a brand new characteristic requirement that reduces system availability, automate the duty of figuring out your app’s options as a part of your construct system. By storing the badging output of the aapt2 device in a textual content file and checking the file into model management, you possibly can observe all declared permissions and explicitly and implicitly required options out of your closing common apk. This consists of all options and permissions included by transitive dependencies, along with your personal.

You’ll be able to automate badging as a part of your steady integration setup by establishing three Gradle duties for every variant of your app you need to validate. Utilizing launch for example, create these three duties:

    • generateReleaseBadging – Generates the badging file from the common APK utilizing the aapt2 executable. The output of this job (the badging data) is used for the next two duties.
    • updateReleaseBadging – Copies the generated badging file into the primary undertaking listing. The file is checked into supply management as a golden badging file.
    • checkReleaseBadging – Validates the generated badging file in opposition to the golden badging file.

CI ought to run checkReleaseBadging to confirm that the checked-in golden badging file nonetheless matches the generated badging file for the present code. If code adjustments or dependency updates have prompted the badging file to alter in any means, CI fails.

Screen grab of failing CI due to adding a new permission and required feature without updating the badging file.

Failing CI as a consequence of including a brand new permission and required characteristic with out updating the badging file.

When adjustments are intentional, run updateReleaseBadging to replace the golden badging file and recheck it into supply management. Then, this transformation will floor in code evaluation to be validated by reviewers that the badging adjustments are anticipated.

Screen grab showing updated golden badging file for review with additional permission and implied required feature.

Up to date golden badging file for evaluation with extra permission and implied required characteristic.

CI-automated badging guards in opposition to adjustments inadvertently inflicting a brand new characteristic to be required, which would scale back availability of the app.

For an entire working instance of a CI system verifying the badging file, take a look at the setup within the Now in Android app.

Hold options non-compulsory

Android units are frequently turning into extra diversified, with customers anticipating an important expertise out of your Android app no matter the kind of system they’re utilizing. Whereas some software program or {hardware} options is perhaps important to your app’s perform, in lots of instances they shouldn’t be strictly required, needlessly stopping some customers from downloading your app.

Use the badging output from aapt2 to verify which options your app requires, and use the Play Console to confirm which units the necessities are stopping from downloading your app. You’ll be able to mechanically verify your app’s badging in CI and catch regressions.

Backside line: In case you don’t completely want a characteristic on your complete app to perform, make the characteristic non-compulsory to make sure your app’s availability to the best variety of units and customers.

Study extra by testing our developer information.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments