【问题标题】:How do I restrict an android app to be available on only devices that accept a sim card? [duplicate]如何限制 Android 应用程序仅在接受 SIM 卡的设备上可用? [复制]
【发布时间】:2017-07-06 10:45:03
【问题描述】:

我正在开发一个应用程序,该应用程序使用的功能只有在设备可以接收短信时才可用。如何确保该应用仅与 sim 卡可接受的设备兼容?

【问题讨论】:

  • 这应该可以完成工作(将其添加到 AndroidManifest):
  • @bluefalcon 不,不是重复的,用户想在运行应用程序之前知道 SIM 卡是否可用
  • @MatPag 你是对的,撤回我的投票结束。

标签: android android-manifest


【解决方案1】:

您可以在 AndroidManifest.xml 中使用 uses-feature 标志

<uses-feature android:name="android.hardware.telephony" android:required="true" />

通过使用它,它将为您过滤无模拟设备。 https://developer.android.com/guide/topics/manifest/uses-feature-element.html

【讨论】:

    【解决方案2】:

    您应该在AndroidManifest.xml 中使用标志

    以这种方式将 uses-feature 行添加到您的清单中:

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="your.package.app">
    
        <!-- Add this line to your manifest -->
        <uses-feature android:name="android.hardware.telephony" android:required="true" />
    
        <!-- other declarations -->
        [....]
    
    </manifest>
    

    这样一来,Google Play 商店就不会列出您的应用程序适用于没有 SIM 或无线电通信的设备。

    更多信息here in the Telephony hardware features section

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-20
      • 2016-02-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多