问题描述
我正在开发只能安装在手机而不是平板电脑上的应用.
I'm working on app that should be installed only on phones and not tablets.
我想问,如何限制只能安装在手机上?
I want to ask, how can I restrict to install only on phones?
我正在阅读这篇文章,但对我来说似乎很老:分发到特定屏幕
I was reading this article, but it seems pretty old to me: Distributing to Specific Screens
他们根本不是在谈论 xxhdpi 或 xxxhdpi 分辨率,设备是按屏幕大小划分的.几年前它可以工作,但现在呢?例如,Nexus 6 的屏幕尺寸为 6 英寸 - 它几乎可以被视为平板电脑.
They are not talking about xxhdpi or xxxhdpi resolutions at all and devices are divided by screen size. It could work few years ago, but now? For example Nexus 6 has 6" screen size - it can be considered almost like tablet.
您知道任何可行的解决方案吗?
Do you know any working solution?
推荐答案
如果我们使用 adb install 命令来安装应用程序,则无法将应用程序安装限制为仅在平板电脑或手机上.此外,如果我们在清单中提供标签,它仅适用于 Google Play 商店过滤器,要检查这一点,您可以尝试以下代码,将其放入清单中并尝试将其安装在 7 英寸平板电脑中,它会允许,
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" />
通过使用此代码,Google Play 商店仅在安装时过滤和限制,但在其他情况下不作为共享 apk 或在模拟器中安装.
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.
因此,当您在市场上上传 APK 时,要将应用安装限制在特定设备上,您需要这样做应用程序->选择您的应用程序->APK-> 支持的设备 |排除的设备
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:禁止在平板电脑上安装应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!