Make android app not availble for tablets

aveschini picture aveschini · Mar 21, 2013 · Viewed 14.4k times · Source

I am publishing my app in the Play store and i don't want it to be available for tablets. How can i make it happen?

I don't want to manually exclude every single tablet within the developer console of android but i really need my application to run exclusively on smartphone.

EDIT: I did as you suggested but here's the result:

enter image description here

And for further explanation: i need my app to run on devices that normal people call smartphone and not on devices that normal people call tablets... e.g. it has to run on "Galaxy Note 2" but not on "Galaxy Tab"

SOLVED Thanks to @CommonsWare:

I had to set the following tags in my manifest:

<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="9"/>

and:

<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" />
    <!-- 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" />
    <!-- all large size screens -->
    <screen android:screenSize="large" android:screenDensity="ldpi" />
    <screen android:screenSize="large" android:screenDensity="mdpi" />
    <screen android:screenSize="large" android:screenDensity="hdpi" />
    <screen android:screenSize="large" android:screenDensity="xhdpi" />
</compatible-screens>

And do the following: Right click on project -> properties -> android -> select a target greater than 8

Answer

CommonsWare picture CommonsWare · Mar 21, 2013

http://developer.android.com/guide/practices/screens-distribution.html#FilteringHansetApps

...you can use the element to manage the distribution of your application based on combinations of screen size and density. External services such as Google Play use this information to apply filtering to your application, so that only devices that have a screen configuration with which you declare compatibility can download your application.

The sample <compatible-screens> element from that page:

<manifest ... >
    <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" />
        <!-- 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" />
    </compatible-screens>
    ...
    <application ... >
        ...
    <application>
</manifest>

However, I would recommend also adding lines for a density of xxhdpi, as such devices are shipping now (Droid DNA, Xperia Z, HTC Butterfly, etc.).


UPDATE

First, with respect to your build errors, if you read the documentation for the <compatible-screens> element, you will notice that it was added in API Level 9, and for some strange reason, you build target is set older than that.

Second, with respect to:

i need my app to run on devices that normal people call smartphone and not on devices that normal people call tablets... e.g. it has to run on "Galaxy Note 2" but not on "Galaxy Tab"

This is not possible, simply because you do not have a concrete definition of what you do and do not want your app shipping on.

There are ~8 billion "normal people" on the planet. You are welcome to interview each one of them and ask them what they think the Galaxy Note 2 is. Some will say a phone. Some will say a tablet. Some will say a "phablet", which will not be useful. Some will chase you out of their homes, claiming that you have brought some light-emitting demon into their midst (this too will not be useful, and may be painful if they have stones handy to throw).

If, at some point in time in the future, you come up with a scientific definition of what you do and do not want to ship your device on, ask a fresh StackOverflow question. By "scientific definition", I mean an algorithm that can be universally applied, by all people on all devices, to determine what you do and do not want your app on.

(note that by "all people", I am excluding those who might consider you to be a demon-monger)

For example:

  • "I want to ship on all devices that have telephony capability, regardless of screen size"

  • "I want to ship on all devices that have a screen size smaller than such-and-so many inches on its smallest side: