Android权限未在调试中提示用户
我是Android开发的新手,正在开发一款需要NFC许可的应用程序。由于某些原因,当应用程序打开时,或者当我将其放在NFC标签或终端附近时,它不会提示用户。下面是我的AndroidManifest.xml。有人能告诉我我做错了什么吗Android权限未在调试中提示用户,android,nfc,android-permissions,Android,Nfc,Android Permissions,我是Android开发的新手,正在开发一款需要NFC许可的应用程序。由于某些原因,当应用程序打开时,或者当我将其放在NFC标签或终端附近时,它不会提示用户。下面是我的AndroidManifest.xml。有人能告诉我我做错了什么吗 <?xml version="1.0" encoding="utf-8"?> NFC许可被归类为保护\u正常(请参阅)。因此,该权限不需要明确的用户同意,并且根本不应该有请求提示: 发件人: 如果您的应用程序在其清单中列出了正常权限(即不会对
<?xml version="1.0" encoding="utf-8"?>
NFC许可被归类为
保护\u正常
(请参阅)。因此,该权限不需要明确的用户同意,并且根本不应该有请求提示:
发件人:
如果您的应用程序在其清单中列出了正常权限(即不会对用户隐私或设备操作造成太大风险的权限),系统会自动将这些权限授予您的应用程序
[……]
只有危险的权限需要用户同意。[……]
顺便说一句,如果你的意思是你的应用程序不会触发NFC标记发现事件,那么原因是你的清单中似乎没有任何NFC标记发现的意图过滤器。例如,请参阅如何注册标签发现。您需要编写代码以在运行时请求权限。它不会自动提示。请参阅
<uses-permission android:name="android.permission.NFC"/>
<uses-feature android:name="android.hardware.nfc.hce" android:required="true" />
<uses-feature android:name="android.hardware.nfc" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name=".MyHostApduService" android:exported="true"
android:permission="android.permission.BIND_NFC_SERVICE">
<intent-filter>
<action android:name="android.nfc.cardemulation.action.HOST_APDU_SERVICE"/>
</intent-filter>
<meta-data android:name="android.nfc.cardemulation.host_apdu_service"
android:resource="@xml/apduservice"/>
</service>
</application>