Application not visible in Tap and Pay
Asked Answered
A

3

5

What is the key thing to adjust in NFC HCE application to get it visible under settings NFC Tap and Pay

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 declaration in manifest:

<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>

I'm missing something but not sure what and where to put it.

Thanks.

Awesome answered 9/6, 2014 at 10:12 Comment(1)
Could you post your app manifest and the host-apdu-service XML file?Adermin
A
9

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>

The service banner should be a graphic file (e.g. a .png file) with dimensions of 260 x 96 pixels.

Adermin answered 11/6, 2014 at 11:12 Comment(3)
There is no text available along with the banner ?Awesome
I'm not 100% sure but I don't think so.Adermin
There is only a banner available, no text is shown.Rodmann
W
3

Additional information - if you forget the following two lines in the manifest, the application will also not show up in "tap and pay" menu.

<uses-feature android:name="android.hardware.nfc.hce" android:required="true" />
<uses-permission android:name="android.permission.NFC" />
Winna answered 13/12, 2017 at 9:44 Comment(0)
H
2

Using this Google sample project, I tried to add the suggestions by @Michael Roland (eg. adding android:apduServiceBanner, category and description).

As a result, the graphic shows up in the Tap and Pay Settings screen, but not the text. I logged an issue with the sample project, but do not expect any resolution.

The current workaround is to create a apduServiceBanner drawable that has the text built into the drawable.

Helios answered 14/9, 2017 at 19:29 Comment(2)
Hey @Helios can I have some official docs regarding of tap and pay with dependency? I tried to search but don’t get anything.Psychosocial
hello @AnshulTyagi check out this documentation: developer.android.com/guide/topics/connectivity/nfc/…Helios

© 2022 - 2024 — McMap. All rights reserved.