这个问题在这里已经有了答案:
Optional permissions so an app can show on all devices and enable optional features on some?
(1 个回答)
7年前关闭。
我有一个刚刚发布到 Play 商店的应用程序,当我尝试从没有电话功能的平板电脑访问它时,它显示为“此应用程序与您的所有设备不兼容”。它在实际的 Android 手机上安装得很好。
事情是这样的——我们希望用户能够在平板电脑和其他没有电话的设备上安装应用程序,并且让电话功能无法正常工作。但如果我在 list 中包含 CALL_PHONE 权限,Play Store 根本不允许安装它。
<uses-permission android:name="android.permission.CALL_PHONE" />
如何让 Google Play 允许要求 CALL_PHONE 权限的应用安装在没有手机的设备上?
最佳答案
您可以指定 Telephony 是可选的:
<uses-feature android:name="android.hardware.telephony" android:required="false"/>
documentation说:
The table below lists permissions that imply feature requirements equivalent to those declared in elements. Note that declarations, including any declared android:required attribute, always take precedence over features implied by the permissions below.
For any of the permissions below, you can disable filtering based on the implied feature by explicitly declaring the implied feature explicitly, in a element, with an android:required="false" attribute. For example, to disable any filtering based on the CAMERA permission, you would add this declaration to the manifest file:
<uses-feature android:name="android.hardware.camera" android:required="false" />
在您的情况下,表格的相关部分是:
Cateegory This permission... Implies This Feature Requirement
Telephony CALL_PHONE android.hardware.telephony
CALL_PRIVILEGED android.hardware.telephony
MODIFY_PHONE_STATE android.hardware.telephony
PROCESS_OUTGOING_CALLS android.hardware.telephony
READ_SMS android.hardware.telephony
RECEIVE_SMS android.hardware.telephony
RECEIVE_MMS android.hardware.telephony
RECEIVE_WAP_PUSH android.hardware.telephony
SEND_SMS android.hardware.telephony
WRITE_APN_SETTINGS android.hardware.telephony
WRITE_SMS android.hardware.telephony
关于android - 如何要求 android.permission.CALL_PHONE 但仍安装在平板电脑上?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29851303/