All Articles

Exclude tablets while including large displays

One day in January my client asked me how come he couldn’t find their app on Google Play with his new Pixel. I had only been around their code for a month, but I reassured him it was temporary. After all QA fires trivial problems wrapped up in a code red package every now and then. Either you learn to filter the flaming hot packages or you’ll get burned. My filter is class A.

Well, the day after QA refired the issue. A customer had asked why the app were no where to be found on Play with his brand new device. Apparently my filter was broken and I started poking around.

Excluding devices like in the official documentation

Since I know my Android I also know that the AndroidManifest.xml is the place to look for device targeting declarations. The official documentation is pretty straight forward on this matter, use the <compatible-screens> element to exclude tablets. My predessor dev had done his research and simply pasted the block mentioned in the doc:

<compatible-screens>
<!-- all small size screens -->
<screen android:screenSize="small" android:screenDensity="ldpi" />
...
<!-- all normal size screens -->
...
<!-- all large size screens -->
...
</compatible-screens>

He even added support for “large screens”! These extra elements aren’t even mentioned in the docs. Something’s clearly fishy if the docs are so outdated “large” screens didn’t exist.

After some discussions with my client I decided to simply remove the whole block. It was a panic solution, but we rather include all devices than exclude all new devices. Good lawd, exluding all devices coming out during 2017… wth. We’re talking Samsung S8, S8+, Nexus, LG, Sony you name it. Better include tablets and have a couple of annoyed customers (because our target audience is probably not using tablets to download the app anyway)

Google to the rescue

4 months later all was fine and dandy. Well, at least up until Google complained that our app was fugly on tablets, “You must exclude tablets, the documentation has further instructions”. Duh! Since my client has a good relationship with Google we kindly explained that we followed the official docs, resulting in us excluding like every device released since Q2 2016.

A day later Google gave us the magic solution, whew. [Not an exact quote]

In order to exclude tablets you can restrict the application to only support devices with hardware support for telephony and other “phone” specific hardware. The <uses-feature android:name="android.hardware.telephony" required="true"/> will exclude most tablets.

That’s it!

<uses-feature android:name="android.hardware.telephony" required="true"/>

I found that “solution” on StackOverflow as well, but seriously I doubted that the best approach for excluding very-large-screens would be to exclude by hardware. Well apparently it is the solution.

Aftermath

I seriously wonder if Google has any clue how much trouble the old official instructions causes developers around the globe today. Some product owners will be clueless about this for quite a while as well since it’s a subtle “bug”. I get a little anxious just by thinking about how many products there must be out there experiencing this problem!

There are questions on StackOverflow addressing this, most folks solve it by adding support for the new screens as they come. “Oh hai has anyone updated compatible screens for the new Samsung S9???”; That’s a very error-prone solution, you’ll always be one step behind. At least Googles solution is future-proof (afaik.)

I will try to get in touch with Google “personally” about this to raise my concern, hopefully they’ll listen. Meanwhile, handle <compatible-screens> with extreme care.

Published 14 May 2017