Make android app not availble for tablets

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:

Leave a Comment