Adding my app as a select and pay option in Android
I am trying to get some information on how to add my app as a connection and payment option for android devices.
Apps like PayPal and Android Pay can be set as the default app to launch when an NFC contact is found. I would like my payment app to be a launch option when someone pushes NFC.
Currently, my app can use NFC thanks to the Android Beam functionality, but I was curious to know how I can enable my app as the default option to connect to payment so that the NFC faucet will launch the app directly.
source to share
I am trying to do the same as you and found this question that allows you to show your application as a payment method.
Application does not appear in Tap and Pay
add these lines to app tag in android manifest ...
<service android:exported="true" android:name="my.package.MyPaymentService" 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>
and then create a file called apdusehvices.xml in the xml folder with this content ...
<host-apdu-service xmlns:android="http://schemas.android.com/apk/res/android"
android:requireDeviceUnlock="true"
android:apduServiceBanner="@drawable/ic_fingerprint_error">
<aid-group
android:category="payment"
android:description="@string/app_name" >
<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>
you will need to set string variables in your values => strings and background image in your drawing folder.
Now I can select my app as the Tap & Pay app, but when I select it the app crashes and I guess it's because I didn't create a Service class there and the manifest points to my.package.MyPaymentService.
source to share