Android 应用内购买:在定位 Android 6 时是否需要检查 com.android.vending.BILLING 权限?

Android in-app purchases: do you need to check for the com.android.vending.BILLING permission when targeting Android 6?

在实施应用内结算或 IAB 时,docs 表示您必须将其添加到您的清单中:

<uses-permission android:name="com.android.vending.BILLING" />

自 Android 6 起,应用属于 expected to check at runtime if users have granted permissions that don't belong to the 'normal 权限类别。请注意,在 API 级别 23 中,com.android.vending.BILLING 未在该类别下的任何位置列出。所以...

  1. 如果不正常,是否意味着危险?
  2. 在使用 IAB 之前我需要检查权限吗?
  3. 如果我这样做,怎么做?我找不到任何与新的 Android 6 权限模型集成的 IAB 示例。例如,在 Manifest.permission 下似乎没有任何与计费相关的权限。

您在 Android 6.0 的正常或危险权限列表中找不到 com.android.vending.BILLING 权限,因为它不是系统权限。

它由包 com.android.vending 声明(a.k.a。Google Play 商店)。你可以在他的 AndroidManifest.xml:

中找到它
<permission
    android:name="com.android.vending.BILLING"
    android:description="@string/perm_billing_desc"
    android:label="@string/perm_billing_label"
    android:permissionGroup="android.permission-group.NETWORK"
    android:protectionLevel="normal"/>

您不需要在运行时检查权限,因为它只需要系统权限。

您可以在此处找到有关应用程序声明权限的更多信息: http://developer.android.com/guide/topics/manifest/permission-element.html