Android Manifest Restrict to Tablets

Android Manifest Restrict To Tablets

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

Sample Image

How to restrict app for tablet in Android?

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.

How to restrict app to Android phones only

Quoting the documentation:

Because the system generally scales applications to fit larger screens well, you shouldn't need to filter your application from larger screens. As long as you follow the Best Practices for Screen Independence, your application should work well on larger screens such as tablets. However, you might discover that your application can't scale up well or perhaps you've decided to publish two versions of your application for different screen configurations. In such a case, you can use the <compatible-screens> 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.

Bear in mind that <compatible-screens> requires you to whitelist every screen size and density that you are supporting (and we get a new density every year or so), and you are limited to the classic screen size buckets (small, normal, large, xlarge). The documentation's sample is missing some densities:

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

You will need to add additional elements if are willing to support tvdpi, xxhdpi, and xxxhdpi devices.

Quoting the documentation for <compatible-screens>:

Caution: Normally, you should not use this manifest element. Using this element can dramatically reduce the potential user base for your application, by not allowing users to install your application if they have a device with a screen configuration that you have not listed. You should use it only as a last resort, when the application absolutely does not work with specific screen configurations. Instead of using this element, you should follow the guide to Supporting Multiple Screens to provide scalable support for multiple screens using alternative layouts and bitmaps for different screen sizes and densities.

And bear in mind that marketing terms like "phablet" is ill-defined, and so your app may wind up shipping on some devices that you happen to think is a phablet or that somebody else thinks is a phablet.

Restrict app installing in Tablets

We can install the android app in two ways.

  1. adb install command
  2. From Google Play store

Using the adb install command, No one can restrict the app installation only to tablets or phone. The , and so on in the manifest settings file is only applicable for the Google Play store filter. We can restrict the app installation to certain device by when you upload your APK at Market see All Applications > select your application > APK > Supported devices | Excluded devices.

Android : Restrict app not to run on Tablet

Why do you want it to only run on non-tablets? Is there a feature (like SMS) you need? If so, add a uses-feature tag in your manifest. If its based on screen size, why not just scale up and get more users?

Also, screen size means nothing for phone vs tablet. My phone is a Note 2, it has more pixels than original generation tablets. You could disable all the devices you don't want on the play store, but it would be a pain.

Manifest screen support Entry for Device only and Tablet Only

After trying all possible combination of support screen and SDK version i am still not able to restrict 10 inch tablet device to download that application.

If you just want to exclude 10 Inch tablet device just exclude all tablet device manually from supporting device list.

If you have another build for the same application upload that build too and keep its version code higher than device build. Version code must not be conflict in any case. Because if multiple apk support for any device the higher version apk will support that device.

When i upload both build in my google account following note/warning appears to help me:

"Warning: Multiple active APKs support some of the same devices. If a device is supported by more than one APK, it will receive the one with the higher version."

and following the manifest entry of my application:

for Device Build:

<uses-sdk
android:minSdkVersion="6"
android:targetSdkVersion="8" />

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

For Tablet Build:

<uses-sdk
android:minSdkVersion="6"
android:targetSdkVersion="8" />

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

Android: Disable to install app on tablets

To install app if we are using adb install command , it's not possible to restict app installation only to tablets or phones.
Also if we give tag in menifest it's only applicable for the Google Play store filter, to check this you can try following code, put it into your menifest and try to install it in 7 inch tablet, it will allow,

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

By using this code Google play store filters and restrict while installing only, but not in other cases as sharing apk, or installing in emulator.

So, to restrict the app installation to certain device when you upload APK at market , you need to do this
Applications->select your application->APK-> Supported devices | Excluded devices

Android: Disable application for tablet

Include following in your Manifest:

<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" />
<screen android:screenSize="small" android:screenDensity="xxhdpi" />
<screen android:screenSize="small" android:screenDensity="xxxhdpi" />
<!-- 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" />
<screen android:screenSize="normal" android:screenDensity="xxhdpi" />
<screen android:screenSize="normal" android:screenDensity="xxxhdpi" />
</compatible-screens>
</manifest>

This will help you.



Related Topics



Leave a reply



Submit