Anonymous
Anonymous

Reputation: 1320

NFC Tap and Pay Broadcast Receiver

I was researching to find if there is a way currently to receive a broadcast event when someone changes default payment app in Tap & Pay option inside settings

The article related to this which i found was https://developer.android.com/reference/android/nfc/NfcAdapter#ACTION_PREFERRED_PAYMENT_CHANGED which will be added in Android R.

Is there any other way an android app can detect on its launch whether its the default app set in Tap and Pay Option?

Any help is appreciated, thank you!

Upvotes: 0

Views: 471

Answers (1)

Anonymous
Anonymous

Reputation: 1320

Found the answer for this here

https://developer.android.com/guide/topics/connectivity/nfc/hce#CheckIfDefault

 val isAppNFCDefault = cardEmulationManager.isDefaultServiceForCategory(
        ComponentName(
            this@MainActivity,
            MyHostApduService::class.java
        ), CardEmulation.CATEGORY_PAYMENT
    )

Upvotes: 0

Related Questions