Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to restrict app for tablet in Android?

i want to my app run only mobile device not in the

tablet 10 and 7 inch

. but my app is run on both tablet size .please help me out

like image 745
VKSingh Avatar asked Feb 06 '13 12:02

VKSingh


2 Answers

Yes as @OceanLife says you Should Go with compatible-screens or supports-screens.

but I would like to add Something here.

if you are using

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

then note what official compatible-screens documentation says:

if you want your application to be available only for large and xlarge screen devices, the element allows you to declare that your application does not support small and normal screen sizes. External services (such as Google Play) will filter your application accordingly. You can also use the element to declare whether the system should resize your application for different screen sizes.

So it will effect after you will upload your apk file to PlayStore. untill you will not get this feature affected.

Also see the Filters on Google Play document for more information about how Google Play filters applications using this and other manifest elements.

Hope it will Help.

like image 162
Bhavesh Patadiya Avatar answered Sep 22 '22 15:09

Bhavesh Patadiya


The google developer has very detail information on that so please check this link:
Distributing to Specific Screens

Quoting relevant parts below.

Handsets only:

Declaring an App is Only for Handsets

<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>

Tablets only:

Declaring an App is Only for Tablets

If you don't want your app to be used on handsets (perhaps your app truly makes sense only on a large screen) or you need time to optimize it for smaller screens, you can prevent small-screen devices from downloading your app by using the manifest element.

<manifest ... >
    <supports-screens android:smallScreens="false"
                      android:normalScreens="false"
                      android:largeScreens="true"
                      android:xlargeScreens="true"
                      android:requiresSmallestWidthDp="600" />
    ...
    <application ... >
        ...
    </application>
</manifest>
like image 42
user2204219 Avatar answered Sep 23 '22 15:09

user2204219