Improve your app’s availability throughout machine varieties

Posted by Alex Vanyo – Developer Relations Engineer

TL;DR: Take away pointless function necessities that forestall customers from downloading your app on gadgets that don’t assist the options. Automate monitoring function 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 dependent upon a hardware or software feature. By default, <uses-feature> specifies {that a} function is required. To point that the function is elective, you need to add the android:required=”false” attribute.

Google Play filters which apps can be found to obtain based mostly on required options. If the person’s machine doesn’t assist some {hardware} or software program function, then an app that requires that function received’t be obtainable for the person to obtain.

<uses-permission>, one other app manifest component, complicates issues by implicitly requiring options for permissions resembling CAMERA or BLUETOOTH (see Permissions that imply feature requirements). The preliminary declared orientations on your actions also can implicitly require {hardware} options.

The system determines implicitly required options after merging all modules and dependencies, so it is probably not clear to you which ones options your app in the end requires. You won’t even bear in mind when the checklist of required options has modified. For instance, integrating a brand new dependency into your app would possibly introduce a brand new required function. Or the mixing would possibly request further permissions, and the permissions might introduce new, implicitly required options.

This conduct has been round for some time, however Android has modified so much through the years. Android apps now run on telephones, foldables, tablets, laptops, vehicles, TVs and watches, and these gadgets are extra assorted than ever. Some gadgets don’t have telephony providers, some don’t have touchscreens, some don’t have cameras.

Expectations based mostly on permissions have additionally modified. With runtime permissions, a <uses-permission> declaration within the manifest not ensures that your app will likely 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 machine’s location, a person could want to at all times seek for a specific location as an alternative.

Banking apps shouldn’t require the machine 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 machine 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 value causes, so strictly requiring a {hardware} touchscreen shouldn’t be vital.

Apps ought to assist each panorama and portrait orientations, in order that they shouldn’t require that the display screen may very well be landscape-oriented or may very well be portrait-oriented. For instance, screens in-built to vehicles could also be in a hard and fast panorama orientation. Even when the app helps each panorama and portrait, the app may very well be unnecessarily requiring that the machine helps being utilized in portrait, which might exclude these vehicles.

Decide your app’s required options

You should utilize aapt2 to output information 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 as well verify which gadgets are being excluded from accessing your app.

Improve app availability by making options elective

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

    • Present alternate options in case the function shouldn’t be obtainable, guaranteeing your app doesn’t want the function to operate.
    • Add android:required=”false” to present <uses-feature> tags to mark the function as not required (or take away the tag totally if the app not makes use of a function).
    • Add the <uses-feature> tag with android:required=”false” for implicitly required function because of declaring permissions that imply feature requirements.

Forestall regressions with CI and badging

To protect in opposition to regressions brought on by inadvertently including a brand new function requirement that reduces machine 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 software in a textual content file and checking the file into model management, you’ll be able to observe all declared permissions and explicitly and implicitly required options out of your remaining common apk. This contains all options and permissions included by transitive dependencies, along with your individual.

You possibly can automate badging as a part of your steady integration setup by establishing three Gradle duties for every variant of your app you wish 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 mission 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 brought about 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 because of including a brand new permission and required function 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 modification 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 further permission and implied required function.

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

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

Preserve options elective

Android gadgets are regularly turning into extra assorted, with customers anticipating an important expertise out of your Android app no matter the kind of machine they’re utilizing. Whereas some software program or {hardware} options is perhaps important to your app’s operate, in lots of circumstances 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 gadgets the necessities are stopping from downloading your app. You possibly can robotically verify your app’s badging in CI and catch regressions.

Backside line: In the event you don’t completely want a function on your whole app to operate, make the function elective to make sure your app’s availability to the best variety of gadgets and customers.

Be taught extra by testing our developer guide.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button