Nik
Nik

Reputation: 3133

How to prevent app installing on tablet in Android?

I am told to build an app in Android 2.2 which will not support tablets.

I went through lots of googling but found no solution. I also found this link but this give how to do the same from 2.3 onwards.

My problem is that I can't switch to 2.3 as my client want to support the app from 2.2.

Here is the code I am using in my manifest

<supports-screens android:normalScreens="true"
    android:largeScreens="true"
    android:anyDensity="true"/>

The code above doesn't prevent the app to download from tablet, and so it crashes.

Upvotes: 1

Views: 567

Answers (3)

Venkat Reddy
Venkat Reddy

Reputation: 49

try below code

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

Upvotes: 0

lenik
lenik

Reputation: 23498

A little bit unexpected answer, I think, but have your tried to ignore screen sizes completely and just request PHONE features in the manifest? It's quite rare for a tablet to have those, so you effectively filter 'em out. For example, your may write in your AndroidManifest.xml:

<uses-permission android:name="android.permission.CALL_PHONE" />

Upvotes: 1

David Scott
David Scott

Reputation: 1666

The code in that link will work fine. Set your sdkTarget to 2.3 and your minSDK as 2.2.

Upvotes: 1

Related Questions