Android 应用程序在Tap和Pay中不可见
在NFC HCE应用程序中,要使其在设置NFC点击付费下可见,关键是什么 以下代码为应用程序返回true,因此它能够支付:Android 应用程序在Tap和Pay中不可见,android,nfc,hce,android-tap-and-pay,Android,Nfc,Hce,Android Tap And Pay,在NFC HCE应用程序中,要使其在设置NFC点击付费下可见,关键是什么 以下代码为应用程序返回true,因此它能够支付: boolean isDefault = CardEmulation .getInstance(NfcAdapter.getDefaultAdapter(this)) .isDefaultServiceForCategory( new ComponentName(t
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:
<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>
我遗漏了一些东西,但不知道该放在哪里
谢谢。为了在点击付费菜单中显示,HCE应用程序必须提供横幅图形。您可以使用
android:apduServiceBanner
属性将图形包含到主机apdu服务XML中:
<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文件)。使用这个谷歌示例,我尝试添加@Michael Roland的建议(例如添加android:apduServiceBanner、类别和描述)
因此,点击和付款设置屏幕中会显示图形,但不会显示文本。
我在示例项目中记录了一个问题,但不希望有任何解决方案
当前的解决方法是创建一个apduServiceBanner绘图表,该绘图表中内置了文本。其他信息-如果您忘记了清单中的以下两行,应用程序也不会显示在“点击付款”菜单中
你能发布你的应用程序清单和主机apdu服务XML文件吗?横幅上没有文本吗?我不是100%确定,但我不这么认为。只有横幅可用,没有文本显示。嘿@Phileo99我能有一些关于点击付费的官方文档吗?我试图搜索,但没有得到任何结果。hello@AnshulTyagi查看以下文档:
<uses-feature android:name="android.hardware.nfc.hce" android:required="true" />
<uses-permission android:name="android.permission.NFC" />