2

My application supports only Android TV devices. I've uploaded it to Google Play Developers Console with the following AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />

<uses-feature
    android:name="android.hardware.touchscreen"
    android:required="false" />
<uses-feature
    android:name="android.software.leanback"
    android:required="true" />

<application
    android:name=".MediaApplication"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/Theme.Leanback">
    <activity
        android:name=".presentation.main.MainActivity"
        android:banner="@drawable/app_icon"
        android:icon="@drawable/app_icon"
        android:label="@string/app_name"
        android:logo="@drawable/app_icon"
        android:screenOrientation="landscape">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
        </intent-filter>
    </activity>

The problem is, that currently it shows only 28 supported devices and devices I've used for testing the application, such as Nexus Player and Xiaomi Mi Box 3 are displayed as unsupported with the message:

This device model is not supported in your app's APK manifest and hence users of this device model cannot install your app.

Other popular Android TV devices like Nvidia Shield TV are also unsupported. Seems to be like everything is correct in AndroidManifest.xml for me and all activities use android:screenOrientation="landscape". Any ideas why is it unavailable for such devices?

yyunikov
  • 5,719
  • 2
  • 43
  • 78
  • Try removing `RECORD_AUDIO`. – CommonsWare Jun 01 '17 at 20:31
  • @CommonsWare but what if it uses record audio for voice search? See their official example https://github.com/googlesamples/leanback-showcase here. – yyunikov Jun 01 '17 at 20:36
  • I have no idea whether the devices that you cited offer the hardware feature offer the `android.hardware.microphone` system feature. I have to assume that only a subset of Android TV devices offer it. And, by requesting `RECORD_AUDIO`, you are *requiring* that the device support `android.hardware.micrphone`. If your app can live without that capability, add a `` element (akin to your `touchscreen` one) to say that it is not required, and check for it at runtime. Perhaps it will help broaden your reach. – CommonsWare Jun 01 '17 at 20:41
  • Also, bear in mind that libraries that you might be using inject their own permissions and possible hardware requirements. Check the merged manifest, available to you in Android Studio in a sub-tab when you edit `AndroidManifest.xml`, and see if everything in there is what you expect. – CommonsWare Jun 01 '17 at 20:43
  • Ok, thanks for the answer! Seems I've found another proof here https://android-developers.googleblog.com/2015/09/new-permissions-requirements-for.html. `When using the Android TV Leanback support library, apps can eliminate the need for requesting RECORD_AUDIO during runtime`. Will check it out as soon as I upload a new version. – yyunikov Jun 01 '17 at 20:43
  • @CommonsWare removing `RECORD_AUDIO` did help. Feel free to submit the answer, I would gladly accept it. – yyunikov Jun 01 '17 at 20:52

2 Answers2

3

The RECORD_AUDIO permission is for unfettered use of the microphone. Certain forms of voice input, particularly when through platform add-ons like Play Services, might not require that permission. I haven't played with voice input and Android TV, but at least once upon a time, apps had no access to the microphone on select Fire TV remotes, as that was reserved for system-level voice search/Alexa commands.

The catch with RECORD_AUDIO is that it implies that you need the android.hardware.microphone system feature. If an Android TV box either lacks a microphone or does not offer it for direct use by app developers, it will not declare that it has that system feature... and therefore your app would block it.

AFAIK, your options are:

  1. Live with the limited audience, because your app needs complete microphone access

  2. Add a <uses-feature> element to say that android.hardware.microphone is not required, then only use the microphone on devices that actually have one (if complete microphone access is not essential for your app)

  3. Eliminate microphone usage entirely, so you can drop RECORD_AUDIO

  4. Find some other way to handle voice input, so you can drop RECORD_AUDIO

From your comment, I assume that you chose option #4. For the benefit of others encountering this question, you might consider answering it yourself, explaining in greater detail why you were requesting it originally and why you feel that you no longer need it.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
1

In my case, I've used a SearchFragment from official Leanback as an example (see AndroidManifest.xml). As can be seen there, it tries to use RECORD_AUDIO permission which made sense for me as there is a Voice Input feature for search which is used on most of the Android TV devices I know. And when RECORD_AUDIO feature was submitted to Google Play it was unsupported on most of the devices.

But as @CommonsWare answered, RECORD_AUDIO permission implies that you need the android.hardware.microphone system feature. And for the devices I've used, microphone is used on remote controller and not on the device itself, so that is probably a reason android.hardware.microphone feature is not available for those devices.

More explanations on why RECORD_AUDIO feature is not needed anymore can be found in post New permissions requirements for Android TV:

When using the Android TV Leanback support library, apps can eliminate the need for requesting RECORD_AUDIO during runtime

If you have an Android TV app targeting API Level 23, please update the app to use SpeechRecognitionCallback and remove RECORD_AUDIO permission from your manifest.

SUMMARY:

If you developing app for Android TV only, there is no need to specify RECORD_AUDIO permission for apps targeting API Level 23+.

In case you support phones and tablets you can specify RECORD_AUDIO permission but as not required with <uses-feature android:name="android.hardware.microphone" android:required="false" />.

yyunikov
  • 5,719
  • 2
  • 43
  • 78