Check Android Tap & Pay settings
Overview
If the device supports NFC Payment and NFC is enabled, Android uses a default payment application for contactless payments.
In Android, the end user can open Tap & Pay in NFC settings and choose the default payment application.
SDK
Check whether the issuer application is the default payment application
This code snippet shows how to check whether the issuer application is the default payment application.
fun isDefaultPaymentApp(context: Context) {
val cardEmulation : CardEmulation = CardEmulation.getInstance(NfcAdapter.getDefaultAdapter(context))
// Construct the ComponentName for the default HCE service class
val componentName : ComponentName = ComponentName(context, D1HCEService::class.java.canonicalName as String)
if (cardEmulation.isDefaultServiceForCategory(componentName, CardEmulation.CATEGORY_PAYMENT)) {
// Issuer application is the default NFC payment application
} else {
// Issuer application is not the default NFC payment application
}
}public void isDefaultPaymentApp(@NonNull Context context) {
CardEmulation cardEmulation = CardEmulation.getInstance(NfcAdapter.getDefaultAdapter(context));
// Construct the ComponentName for the default HCE service class
ComponentName componentName = new ComponentName(context, D1HCEService.class.getCanonicalName());
if (cardEmulation.isDefaultServiceForCategory(componentName, CardEmulation.CATEGORY_PAYMENT)) {
// Issuer application is the default NFC payment application
} else {
// Issuer application is not the default NFC payment application
}
}Prompt the end user to change the default payment application
This code snippet shows how to prompt the end user to set the issuer application as the default payment application in Tap & Pay settings.
Last updated
Was this helpful?