【问题标题】:How to restrict apks to phones and tablets using multiple apk support on google play store?如何使用 Google Play 商店上的多个 apk 支持将 apk 限制为手机和平板电脑?
【发布时间】:2016-04-09 18:04:39
【问题描述】:

我们有两个 apk,我们希望将一个 apk 限制为仅适用于手机,而另一个仅适用于 google play store 上的平板电脑。我们在 AndroidManifest.xml 文件中为此使用了“support-screen”属性,并在 google play 上使用高级模式上传了 apk。我们对平板电脑和手机的设置如下:

对于手机:

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

对于平板电脑:

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

我们在实现这一目标方面取得了部分成功,但在使用像 Sony Xperia D5322 这样的平板手机时我们遇到了问题。它应该显示手机支持 apk,但它显示平板电脑支持 apk。

您能否建议我们正确的配置设置,以便支持 apk 的手机只出现在具有大屏幕和分辨率的手机和平板手机上,而支持 apk 的平板电脑应该只出现在所有类型的平板电脑上(即从 7 英寸平板电脑到 10.1 ” 平板电脑)。

注意:我们已经使用以下设置尝试了兼容屏幕选项,但没有得到我们想要的。所以我们决定只坚持使用支持屏幕选项。

手机:

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

        <!-- For devices like Nexus and Htc One-->
        <screen android:screenSize="large" android:screenDensity="xhdpi" />
    </compatible-screens>

对于平板电脑:

<compatible-screens>
    <!-- For 7 & 8 inch Tablets -->
    <screen android:screenSize="large" android:screenDensity="mdpi" />
    <screen android:screenSize="large" android:screenDensity="hdpi" />
    <!-- For 0 inch tablets -->
    <screen android:screenSize="xlarge" android:screenDensity="ldpi" />
    <screen android:screenSize="xlarge" android:screenDensity="mdpi" />
    <screen android:screenSize="xlarge" android:screenDensity="hdpi" />
    <screen android:screenSize="xlarge" android:screenDensity="xhdpi" />

    </compatible-screens>

【问题讨论】:

  • 您想要的东西是不可能的,除非可能通过进入并手动检查/取消选中您想要/不想运送到的特定设备。您不能根据任意标准将不同的 APK 发送到任意设备。这就是为什么 Google 和大多数专家都建议您拥有一款能够适应不同屏幕尺寸的 APK。
  • @commonsware:感谢您的及时回复。我不希望对任何特定设备进行此类设置,我希望对特定范围的设备进行此类设置。就像我希望特定的 apk 仅对一组设备可见。也就是说,通过上述更改,它满足了大多数设备,但很少有像上面提到的设备不满足标准。所以我只想知道有没有什么方法可以包含这样的平板手机以满足清单文件中满足普通手机的标准。
  • “所以我只想知道有没有什么方法可以包含这样的平板手机以满足清单文件中满足普通手机的标准”——不,你不能。

标签: android google-play apk android-screen-support android-multiple-apk


【解决方案1】:

不可能为不同的设备尺寸提供不同的 APK,但是可以有一个 APK 并检测屏幕尺寸,然后进行相应的调整。查看this websitethis website 了解有关调整屏幕尺寸的更多信息。

尝试在布局中使用wrap_contentmatch_parent 变量,它们应根据安装设备的比例调整应用程序。

希望这会有所帮助!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多