HCE iOS, get default payment app

Hello,

I develop an HCE payment app.

In this app I can redirect users in Settings to set the default payment app

UIApplication.shared.open(URL(string: "App-prefs:General&path=CONTACTLESS_NFC")

But is it possible to know which app is selected or if my app is already set as default ?

Answered by DTS Engineer in 790136022

It is not possible to query which app is selected by the user as default, as that is their private choice.

But, if your app has indeed been set as the default, you can determine whether it is being launched as the default app.

You will need to implement NFCWindowSceneDelegate (https://developer.apple.com/documentation/corenfc/nfcwindowscenedelegate)

There is a NFCWindowSceneEvent event your app will receive when it is launched due to double press or an NFC field (with payment intent) https://developer.apple.com/documentation/corenfc/nfcwindowsceneevent

If your app has been set as the default, double-pressing the power button will send the "presentation" event. Detecting an eligible RF field (with payment intent) will send the "readerDetected" event

If you encounter these events then you can assume your app has been set as the default payment app for the time being. Of course the user might change this at a later time without you knowing.

Note: If the app is already launched, if it has startEmulation() already for Host Card Emulation, then you may not receive these events.

It is not possible to query which app is selected by the user as default, as that is their private choice.

But, if your app has indeed been set as the default, you can determine whether it is being launched as the default app.

You will need to implement NFCWindowSceneDelegate (https://developer.apple.com/documentation/corenfc/nfcwindowscenedelegate)

There is a NFCWindowSceneEvent event your app will receive when it is launched due to double press or an NFC field (with payment intent) https://developer.apple.com/documentation/corenfc/nfcwindowsceneevent

If your app has been set as the default, double-pressing the power button will send the "presentation" event. Detecting an eligible RF field (with payment intent) will send the "readerDetected" event

If you encounter these events then you can assume your app has been set as the default payment app for the time being. Of course the user might change this at a later time without you knowing.

Note: If the app is already launched, if it has startEmulation() already for Host Card Emulation, then you may not receive these events.

HCE iOS, get default payment app
 
 
Q