> For the complete documentation index, see [llms.txt](https://docs.payments.thalescloud.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.payments.thalescloud.io/nfc-payment/implement-nfc-payment/digitize-a-card/check-android-tap-and-pay-settings.md).

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

{% tabs %}
{% tab title="Android Kotlin" %}

```kotlin
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
    }
}
```

{% endtab %}

{% tab title="Android Java" %}

```java
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
    }
}
```

{% endtab %}
{% endtabs %}

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

{% tabs %}
{% tab title="Android Kotlin" %}

```kotlin
fun setDefaultPaymentApp(context: Context) {
    // Construct the ComponentName for the default HCE service class
    val componentName = ComponentName(context, D1HCEService::class.java.canonicalName)

    val activate = Intent()
    activate.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
    activate.setAction(CardEmulation.ACTION_CHANGE_DEFAULT)
    activate.putExtra(CardEmulation.EXTRA_SERVICE_COMPONENT, componentName)
    activate.putExtra(CardEmulation.EXTRA_CATEGORY, CardEmulation.CATEGORY_PAYMENT)
    context.startActivity(activate)
}
```

{% endtab %}

{% tab title="Android Java" %}

```java
public void setDefaultPaymentApp(@NonNull Context context) {
    // Construct the ComponentName for the default HCE service class
    ComponentName componentName = new ComponentName(context, D1HCEService.class.getCanonicalName());

    Intent activate = new Intent();
    activate.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    activate.setAction(CardEmulation.ACTION_CHANGE_DEFAULT);
    activate.putExtra(CardEmulation.EXTRA_SERVICE_COMPONENT, componentName);
    activate.putExtra(CardEmulation.EXTRA_CATEGORY, CardEmulation.CATEGORY_PAYMENT);
    context.startActivity(activate);
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.payments.thalescloud.io/nfc-payment/implement-nfc-payment/digitize-a-card/check-android-tap-and-pay-settings.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
