29

For business reasons I'd like to restrict my Android application strictly to tablet devices.

At the moment, I can limit the app to Honeycomb devices by setting:

android:minSdkVersion="11"

But the next version of Android (Ice Cream Sandwich) will have a higher version number for both the tablet and phone versions of the OS.

Is there any manifest attribute I can specify to restrict it to tablet devices? (Honeycomb or any later tablet version)

Daniel Delaney
  • 1,183
  • 3
  • 16
  • 21
  • Here's the [blog entry](http://android-developers.blogspot.com/2011/09/preparing-for-handsets.html) specially for you. – ernazm Oct 04 '11 at 14:39

4 Answers4

46

You will find this link awesome: http://android-developers.blogspot.com/2011/09/preparing-for-handsets.html

The problem with what we call "tablet" is that the definition is not the same for evryone. I think about the Archos 5IT that is the same size than a phone but branded with "tablet" name. Same issue with Dell Streak.

I would personnaly not call that a tablet..

So if you want to restrict to 7 or 5 inches devices, you should use xlargeScreens and largeScreens.

(There is also a bug in HTC flyer - 7 inches- that uses largeScreens, blame HTC)

I guess that playing with Screen size in Manifest will fit your needs:

<supports-screens android:smallScreens="false"
                  android:normalScreens="false"
                  android:largeScreens="false"
                  android:xlargeScreens="true"
                  android:anyDensity="true"
                  android:requiresSmallestWidthDp="600"
                  android:compatibleWidthLimitDp="integer"
                  android:largestWidthLimitDp="integer"/>

enter image description here

Waza_Be
  • 39,407
  • 49
  • 186
  • 260
  • I had to use the above code to stop OS 3.2 from giving me a view comp. popup (something specific to 3.2 at the moment) android:xlargeScreens="true" – DJPlayer Oct 04 '11 at 17:01
  • i am not get this option in my manifet file android:requiresSmallestWidthDp="600" android:compatibleWidthLimitDp="integer" android:largestWidthLimitDp="integer" i am use Android 3.0 version... – Mitesh Jain Oct 14 '11 at 04:49
  • 1
    replace integer with something.. Or remove the line! – Waza_Be Oct 14 '11 at 04:50
2

please review the docs - http://developer.android.com/guide/practices/screens-distribution.html.

<manifest ... >
<supports-screens android:smallScreens="false"
                  android:normalScreens="false"
                  android:largeScreens="true"
                  android:xlargeScreens="true"
                  android:requiresSmallestWidthDp="600" />
...
<application ... >
    ...
</application>

gmjordan
  • 314
  • 3
  • 7
2
              android:requiresSmallestWidthDp="600"
              android:compatibleWidthLimitDp="integer"
              android:largestWidthLimitDp="integer"

Be careful, Android Market currently does not support this attribute for filtering (from the official guide).

use support screen large and xlarge and now you have two options:

  • exclude the large screen devices which are not tablets manually from Market(+500...)

  • You can measure programmatically the width and if it width<600 say the user that the app is not compatible.

While that we'll have to wait for the Market to filter by android:requiresSmallestWidthDp="600" ...

AntPachon
  • 1,152
  • 12
  • 14
  • *Be careful* with this approach from now on! A 7" tablet with full HD resolution (1920x1080) has around 315 ppi, thus being a XHDPI/320 device. 1080 / (320/160) equals 540 dp and excludes it from the sw600dp limit. From now on, 7"@1080p tablets will probably be common (Nexus 7 fullHD rumor rings a bell), so it would be embarrassing to tell such user that his tablet is not a tablet! – davidcesarino Feb 05 '13 at 21:31
0

I think the PhoneGap official documentation can help you out: http://phonegap.com/blog/2014/01/30/customizing-your-android-manifest-and-ios-property-list-on-phonegap-build/

nzkevin
  • 113
  • 1
  • 7
  • 1
    Whilst this may theoretically answer the question, [it would be preferable](//meta.stackoverflow.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. – Bhargav Rao Nov 15 '16 at 16:30