36

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

aveschini
  • 1,632
  • 3
  • 22
  • 39
  • 6
    why is that ? (also, please define 'tablet') – njzk2 Mar 21 '13 at 12:47
  • 2
    If the reason is that your application needs phone voice call access, please be aware that some tablets can support voice calls (e.g. I have a ViewSonic ViewPad 7" that is basically just an oversized phone). – Jules Mar 21 '13 at 12:49
  • 1
    If you did'nt want tablets to be included, i wonder why have you also written the elements.? – zulkarnain shah Oct 24 '15 at 06:03
  • Don't do it programmatically. Just exclude some devices in the Google Play Concole. – ekashking Oct 18 '21 at 04:41

4 Answers4

31

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:

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • You are right (and made a very hilarious answer. Honest!). I need to ship on devices smaller than 6 inches. Now i have: But it is still giving me the same errors as in the image i posted! – aveschini Mar 21 '13 at 13:55
  • 1
    @aveschini: You need to set your *build target* to API Level 9 or higher. In Eclipse, that is in Project > Properties > Android. – CommonsWare Mar 21 '13 at 13:57
  • I only had to add the following:                                 – aveschini Mar 21 '13 at 14:50
  • @CommonsWare It seems that a value of `xxhdpi` it is not allowed for `screenDensity`, even the `targetSdkVersion="19"` ... From what I found on SO, we have to use `480` It is correct? – AlexAndro Mar 12 '14 at 14:51
  • @AlexAndro: You have to use `480` instead of `xxhdpi`. – CommonsWare Mar 12 '14 at 14:54
  • Note that today, you need to also support xxhdpi and xxxhdpi and also resolutions in between. Because for older SDK version xxhdpi is not supported you should add those resolutions by number: and the same for 560 and 640 as well as for screenSize="small". – Benjamin Mesing Sep 18 '15 at 18:43
7

Use Support screen tag in manifest file is wrong method. Alway use <compatible-screens> to make your app not available to tablet.

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

Caution

If you use the element for the above scenario (when your application is not compatible with larger screens) and set the larger screen size attributes to "false", then external services such as Google Play do not apply filtering. Your application will still be available to larger screens, but when it runs, it will not resize to fit the screen. Instead, the system will emulate a handset screen size (about 320dp x 480dp; see Screen Compatibility Mode for more information). If you want to prevent your application from being downloaded on larger screens, use as suggested by @CommonsWare.

Use tag for exclude your app to run on tablet.

<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>
Chirag
  • 56,621
  • 29
  • 151
  • 198
  • 1
    This will not work. Android will still ship the app to larger-screen devices and will apply its own algorithm to scale up the UI. – CommonsWare Mar 21 '13 at 12:49
  • As stated in another Thread this solution depends on the definition of 'tablet', which might not be what aveschini wants. – tilpner Mar 21 '13 at 12:50
  • @CommonsWare Thanks for your valuable suggestion. – Chirag Mar 21 '13 at 12:57
  • 'android:resizeable' This attribute is deprecated. from https://developer.android.com/guide/topics/manifest/supports-screens-element.html – Yazazzello Nov 28 '17 at 12:50
2

For those new to the thread, use

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

Source (https://paramsen.github.io/exclude-tablets/)

user12051965
  • 97
  • 9
  • 29
  • 1
    But my tablet does make calls so this would not work for user case where developer doesnt want to deal with tablet layouts. – Robby Lebotha Mar 28 '23 at 06:56
-3

You might try adding a check of some sort for 3g or 4g service. That will exclude most, but probably not all tablets.

user2177896
  • 107
  • 1
  • 2
  • 7