Android设置在尝试设置默认应用程序(基于主机的卡模拟)时崩溃
我正在尝试实现一个Tap&Pay应用程序,因此需要与POS终端进行通信。为此,设备需要将“我的应用程序”设置为Tap&Pay功能的默认应用程序。无论是试图要求用户以编程方式或通过设置应用程序进行设置,android设置都会崩溃 我认为这与清单文件有关,因为崩溃显然发生在列出tap&pay应用程序的过程中 我遵循了android开发者页面上关于基于主机的卡模拟的说明 manifest.xml:Android设置在尝试设置默认应用程序(基于主机的卡模拟)时崩溃,android,nfc,payment,hce,Android,Nfc,Payment,Hce,我正在尝试实现一个Tap&Pay应用程序,因此需要与POS终端进行通信。为此,设备需要将“我的应用程序”设置为Tap&Pay功能的默认应用程序。无论是试图要求用户以编程方式或通过设置应用程序进行设置,android设置都会崩溃 我认为这与清单文件有关,因为崩溃显然发生在列出tap&pay应用程序的过程中 我遵循了android开发者页面上关于基于主机的卡模拟的说明 manifest.xml: <?xml version="1.0" encoding="utf-8"?> <man
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="wizypay.brantner.wizy">
<uses-feature android:name="android.hardware.nfc.hce" android:required="true"/>
<uses-permission android:name="android.permission.NFC" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_wizy"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_wizy"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".acitvities.LoginActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".acitvities.MainActivity" />
<activity android:name=".acitvities.RegisterActivity"/>
<service android:name=".services.HostCardEmulatorService" android:exported="true"
android:permission="android.permission.BIND_NFC_SERVICE">
<intent-filter>
<action android:name="android.nfc.cardemulation.action.HOST_APDU_SERVICE"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
<meta-data android:name="android.nfc.cardemulation.host_apdu_service"
android:resource="@xml/apduservice"/>
</service>
</application>
</manifest>
apduservice.xml:
<host-apdu-service xmlns:android="http://schemas.android.com/apk/res/android"
android:description="@string/servicedesc"
android:requireDeviceUnlock="false"
android:apduServiceBanner="@drawable/my_banner">
<aid-group android:description="@string/aiddescription"
android:category="payment">
<aid-filter android:name="A0000000043060"/>
<aid-filter android:name="315041592E5359532E4444463031"/>
<aid-filter android:name="325041592E5359532E4444463031"/>
<aid-filter android:name="44464D46412E44466172653234313031"/>
<aid-filter android:name="A00000000101"/>
<aid-filter android:name="A000000003000000"/>
<aid-filter android:name="A00000000300037561"/>
<aid-filter android:name="A00000000305076010"/>
...
</aid-group>
</host-apdu-service>
...
我目前正在运行Android 8.1.0的Google Pixel上测试该应用程序
我希望有人知道是什么导致了这次事故,
提前谢谢 您的代码似乎没有任何问题 不过我找到了一个应用程序标识符列表 在玩了一会儿之后,我发现android对可以注册的AIDs的数量设置了一个限制,似乎是260。也许你加的太多了