How to prevent app installing on tablet in Android?

て烟熏妆下的殇ゞ 提交于 2019-12-24 08:31:06

问题


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.


回答1:


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




回答2:


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



回答3:


try below code

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


来源:https://stackoverflow.com/questions/10412005/how-to-prevent-app-installing-on-tablet-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!