Restrict installation of app on devices with screen density hdpi or lower

330 views Asked by At

I am developing an android app which is only for devices with high screen densities. i want to restrict my app on devices having 1.5 screen density or lower than that. I searched a lot about this problem and found out that we can handle this by different tags in manifest like

 <supports-screens android:smallScreens="false"
    android:normalScreens="false"
    android:largeScreens="true"
    android:xlargeScreens="true"/>

I have two devices and both are in normalScreens category. One of them has density equal to 1.5 and other is of 2.0. My question is that how can I restrict my app on devices on the basis of screen densities. Using <compatible-screens> tag should not be the solution of this as google documentation says, "Any size and density combination not explicitly declared in this tag will be restricted from installing the app".

What to do guys please help me out.

1

There are 1 answers

4
Eugen Pechanec On

Any size and density combination not explicitly declared in this tag will be restricted from installing the app.

It sounds like <compatible-screens> is what you want. You'll have to list every possible combination of screens you do support. That's everything except ldpi, mdpi, and hdpi.

https://developer.android.com/guide/topics/manifest/compatible-screens-element https://developer.android.com/guide/practices/screens-distribution#FilteringHandsetApps

So this is a good start:

<compatible-screens>
    <screen android:screenSize="small" android:screenDensity="xhdpi"/>
    <screen android:screenSize="small" android:screenDensity="xxhdpi"/>
    <screen android:screenSize="small" android:screenDensity="xxxhdpi"/>
    <screen android:screenSize="normal" android:screenDensity="xhdpi"/>
    <screen android:screenSize="normal" android:screenDensity="xxhdpi"/>
    <screen android:screenSize="normal" android:screenDensity="xxxhdpi"/>
    <screen android:screenSize="large" android:screenDensity="xhdpi"/>
    <screen android:screenSize="large" android:screenDensity="xxhdpi"/>
    <screen android:screenSize="large" android:screenDensity="xxxhdpi"/>
    <screen android:screenSize="xlarge" android:screenDensity="xhdpi"/>
    <screen android:screenSize="xlarge" android:screenDensity="xxhdpi"/>
    <screen android:screenSize="xlarge" android:screenDensity="xxxhdpi"/>
</compatible-screens>

The documentation lists more supported values for screen density:

  • 320 (xhdpi)
  • 360
  • 420
  • 480 (xxhdpi)
  • 560
  • 640 (xxxhdpi)

The problem is if there's a device with different value that you don't include in your manifest it won't see your app in the Store. For example Sony Xperia Z5 Premium has a density of ~800 dpi and it won't get you app unless you specify screen density of 800 in your manifest.

<screen android:screenSize="normal" android:screenDensity="800"/>

That's just my guess.

So before you go this route, ask yourself, if you really need this. If instead it would be acceptable to inform the user when they first run the app that visual fidelity may not be as high as intended due to atypical display density (or what not, I don't really know your use case). Let the user decide.