Publishing multiple apks with different filters for mobile and tv
Asked Answered
D

1

6

I want to publish multiple apks: one for mobile and other androidtv within same application. As per Publishing Multiple APKs with Different Filters there are only four distinguishing filters within same application:

Currently, Google Play allows you to publish multiple APKs for the same application only when each APK provides different filters based on the following configurations:

  • OpenGL texture compression formats

  • Screen size (and, optionally, screen density)

  • API level

  • CPU Architecture (ABI)

All other filters still work the same as usual, but these four are the only filters that can distinguish one APK from another within the same application listing on Google Play. For example, you cannot publish multiple APKs for the same application if the APKs differ only based on whether the device has a camera.

I thought to distinguish by API levels and screen size but there seems to be an overlap:

  1. API level (MinSDK) for androidtv app is kept at 21 and for mobile app at 16. So there is a overlap of API levels (21 and above).

  2. Screen size for android tv may overlap with that of tablet's: For eg. The common high-definition TV display resolutions are 720p, 1080i, and 1080p. Also Samsung nexus resolution is 720x1280.

I fear if I publish androidtv apk with a higher version, it might replace mobile app on a tablet with API level >= 21 and screen size 720x1280 that also qualifies for tv app layout size.

So how can I clearly differentiate between these two apks using different filters in app's manifest?

UPDATE

I already added leanback feature in androidtv app's manifest

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

I see 42 supported devices for androidtv apk (can't see which devices) and 10791 for mobile apk device and total of 10832 total devices supported for entire application.

10791 + 42 = 10833

So there is still a possibility of 1 (10833 - 10832 = 1) overlapping device because of which warning is displayed.

overlap warning

enter image description here

androidtv apk

enter image description here

mobile apk

enter image description here

total devices

enter image description here

I don't think overlapping message is because of androidtv apk being a super-set of mobile apk as mentioned in one of comments looking at number of supported devices for androidtv which is much less.

Since there is just one possible overlapping device I will publish it but I wish I had known which devices overlap to receive both apks.

Domination answered 26/9, 2016 at 6:6 Comment(0)
H
5

There actually is a "feature" that is used to specifically target Android TV. You can view the instructions in the docs. But basically you just have to specify that it uses the leanback feature like below.

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

This will ensure that any TV device running leanback will get your APK (you can set required=false if you're using one APK). I believe that all official Android TVs are using this feature. It's possible leanback can be on a non-tv device, but in that case all of their apps will be showing up as TV apps.

There are several other features you can disable/enable to target Android TV, you can review the release checklist for more info (specifically this section).

One thing to note is that there are some overlapping devices that both your mobile and TV APK may satisfy. After speaking with a rep on the Play Console team, they recommended the way to get around it:

Regarding the multi-apk scenario where you have overlapping devices - yes, your Android TV APK would always need to have a higher version code. There are a few options to help resolve this:

  1. You can manually blacklist the 2 overlapping devices. This would immediately resolve the issue with overlapping APKs, however if new devices are released in the future that are eligible for both APKs you would face this issue again.

  2. Use a version code scheme for your Android TV APK that is significantly higher than your mobile device APK. For example, your TV APK can be existing version code + 100000, or 100808, while your mobile device APK remains at 838. In this scenario, you could publish mobile device APKs up to version code 100808 without having to update your Android TV APK with every push. This would also resolve any issues with Alpha/Beta testing Android TV APKs.

His response is also covered in the "Assigning version codes" section of this doc.

Humphrey answered 26/9, 2016 at 14:54 Comment(4)
I added leanback feature in manifest yet see a warning for overlapping devices in console. Exact message: "Some devices are eligible to run multiple APKs. In such a scenario, the device will receive the APK with the higher version code."Domination
That is correct, but basically that message is saying that your Android TV APK is a super-set of your mobile APK, but the play store is still smart enough to know that your Android TV APK is more specific. You should set required=true on the TV APK. See the rules for multiple apks section for the exact rules. That document recommends always publishing your Android TV APK with a higher version code to ensure that if a TV has leanback, it will ALWAYS pick the leanback APK.Humphrey
does this means I'll have to publish androidtv apk with an incremented versioncode everytime I publish mobile app apk even though I don't have any changes to androidtv code? Will users receive an update notification for androidtv in this case?Domination
I just did some digging and sent some emails and it looks like the answer to your question is "sort of". I added the full response to my OP. But basically you'll need to give your Android APKs a higher version code always. You can upload a mobile APK with a lower version code that the current TV APK and that makes it so the TV will always be the selected one.Humphrey

© 2022 - 2024 — McMap. All rights reserved.