I'm looking for a way to understand if the user is using Samsung Pay or Google Pay as the default payment app.
Reading from Tap and Pay documentation, you can use
override suspend fun isDefaultWallet(packageName: String, fullClassName: String): Boolean {
val nfcManager = context.getSystemService(Context.NFC_SERVICE) as NfcManager
val emulation = CardEmulation.getInstance(nfcManager.defaultAdapter)
val componentName = ComponentName(packageName, fullClassName)
return emulation.isDefaultServiceForCategory(componentName, CardEmulation.CATEGORY_PAYMENT)
}
For Google Pay:
- package name:
com.google.android.apps.walletnfcrel
- class name:
com.google.android.gms.tapandpay.hce.service.TpHceService
What are the values for Samsung Pay?
For Samsung Pay:
com.samsung.android.spayfw
com.samsung.android.spayfw.core.hce.SPayHCEService