1

I'm creating an application which needs to be installed on mobile devices only and all the tablets should be excluded. There are already many same questions asked but at that time xxxhdpi resolution devices where not launched like Pixel 2 and Samsung Galaxy S8 plus which comes uder large screens. So how to restrict the apps to be installed on mobile devices only?

I tried below code but its not helping.

<compatible-screens>

        <!-- all small size screens -->
        <screen android:screenSize="small" android:screenDensity="ldpi" />
        <screen android:screenSize="small" android:screenDensity="mdpi" />
        <screen android:screenSize="small" android:screenDensity="hdpi" />
        <screen android:screenSize="small" android:screenDensity="xhdpi" />
        <screen android:screenSize="small" android:screenDensity="xxhdpi" />
        <screen android:screenSize="small" android:screenDensity="xxxhdpi" />
        <!-- all normal size screens -->
        <screen android:screenSize="normal" android:screenDensity="ldpi" />
        <screen android:screenSize="normal" android:screenDensity="mdpi" />
        <screen android:screenSize="normal" android:screenDensity="hdpi" />
        <screen android:screenSize="normal" android:screenDensity="xhdpi" />
        <screen android:screenSize="normal" android:screenDensity="xxhdpi" />
        <screen android:screenSize="normal" android:screenDensity="xxxhdpi" />

    </compatible-screens>
rahul shah
  • 2,086
  • 2
  • 11
  • 14
  • 2
    Possible duplicate of [Make android app not availble for tablets](https://stackoverflow.com/questions/15547985/make-android-app-not-availble-for-tablets) – Goku Dec 06 '17 at 11:33
  • where to restrict? on `play store`? if so https://stackoverflow.com/questions/29429070/android-disable-to-install-app-on-tablets – Bek Dec 06 '17 at 11:39
  • Yes only mobile devices can install the app @Bek – rahul shah Dec 06 '17 at 11:41
  • @Prem that answer does not provide me solution for xxxhdpi devices and tablets. – rahul shah Dec 06 '17 at 11:42
  • as @shah has stated that solution will exclude devices with high resolutions. What you can do is add the telephone hardware as a requirement as "some" tablets lack the feature. – Niza Siwale Dec 06 '17 at 11:54
  • @NizaSiwale Yes but that will exclude only some tablets..not all :-) – rahul shah Dec 06 '17 at 11:58
  • @rahulshah The other work around "could" have been listing some screen aspect ratios as incompatible but as of 2017 there is no way of doing that. You can only do that at run time – Niza Siwale Dec 06 '17 at 12:18

1 Answers1

1

To anybody who's facing same issue can try this below code.

<compatible-screens>

    <!-- all small size screens -->
    <screen android:screenSize="small" android:screenDensity="ldpi" />
    <screen android:screenSize="small" android:screenDensity="mdpi" />
    <screen android:screenSize="small" android:screenDensity="hdpi" />
    <screen android:screenSize="small" android:screenDensity="xhdpi" />
    <screen android:screenSize="small" android:screenDensity="xxhdpi" />
    <screen android:screenSize="small" android:screenDensity="xxxhdpi" />
    <!-- all normal size screens -->
    <screen android:screenSize="normal" android:screenDensity="ldpi" />
    <screen android:screenSize="normal" android:screenDensity="mdpi" />
    <screen android:screenSize="normal" android:screenDensity="hdpi" />
    <screen android:screenSize="normal" android:screenDensity="xhdpi" />
    <screen android:screenSize="normal" android:screenDensity="xxhdpi" />
    <screen android:screenSize="normal" android:screenDensity="xxxhdpi" />


    <screen android:screenSize="normal" android:screenDensity="420" />
    <screen android:screenSize="normal" android:screenDensity="480" />
    <screen android:screenSize="normal" android:screenDensity="560" />
    <screen android:screenSize="normal" android:screenDensity="640" />

    <screen android:screenSize="large" android:screenDensity="420" />
    <screen android:screenSize="large" android:screenDensity="480" />
    <screen android:screenSize="large" android:screenDensity="560" />
    <screen android:screenSize="large" android:screenDensity="640" />
</compatible-screens>

Screen density 640 is the highest density for Phone devices. I've checked it on playstore it will exclude all tablets and will include all devices.

rahul shah
  • 2,086
  • 2
  • 11
  • 14