Check Android Tap & Pay settings
Overview
SDK
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
Last updated
Was this helpful?