应用程序在“点击付款"中不可见 [英] Application not visible in Tap and Pay
问题描述
在NFC HCE应用程序中进行调整以使其在NFC Tap and Pay设置下可见的关键是什么
What is the key thing to adjust in NFC HCE application to get it visible under settings NFC Tap and Pay
以下代码为该应用返回true,因此可以付款:
Following code returns true for the app, so it's capable of payment:
boolean isDefault = CardEmulation
.getInstance(NfcAdapter.getDefaultAdapter(this))
.isDefaultServiceForCategory(
new ComponentName(this, MyPaymentService.class),
CardEmulation.CATEGORY_PAYMENT);
清单中的服务声明:
<service
android:name="my.package.MyPaymentService"
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>
apduservice:
apduservice:
<host-apdu-service xmlns:android="http://schemas.android.com/apk/res/android"
android:requireDeviceUnlock="true" >
<aid-group
android:category="payment"
android:description="@string/paymentGroup" >
<aid-filter
android:name="325041592E5359532E4444463031"
android:description="@string/ppse" />
<aid-filter
android:name="A0000000041010"
android:description="@string/mastercard" />
<aid-filter
android:name="A0000000031010"
android:description="@string/visa" />
<aid-filter
android:name="A000000003101001"
android:description="@string/visa" />
<aid-filter
android:name="A0000002771010"
android:description="@string/interac" />
</aid-group>
</host-apdu-service>
我丢失了一些东西,但不确定将其放置在何处.
I'm missing something but not sure what and where to put it.
谢谢.
推荐答案
HCE应用程序必须才能显示在Tap-and-pay菜单中,以便显示在Tap-and-pay菜单中.您可以使用android:apduServiceBanner
属性将图形包含在host-apdu-service XML中:
In order to be shown in the tap-and-pay menu, a HCE app must provide a banner graphic. You would include the graphic into the host-apdu-service XML using the android:apduServiceBanner
attribute:
<host-apdu-service xmlns:android="http://schemas.android.com/apk/res/android"
android:requireDeviceUnlock="true"
android:apduServiceBanner="@drawable/servicebanner">
<aid-group android:category="payment"
android:description="@string/paymentGroup" >
<aid-filter ... />
</aid-group>
</host-apdu-service>
服务标语应为尺寸为260 x 96像素的图形文件(例如.png文件).
The service banner should be a graphic file (e.g. a .png file) with dimensions of 260 x 96 pixels.
这篇关于应用程序在“点击付款"中不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!