NFC Usage conflict when initialize mobile payment SDK on android

I’m currently integrating the mobile payment SDK on Android with my NFC app, however, it seems like when I initialized the SDK, I cannot use the NFC feature in my app because of the resources conflicts (NFC feature is used from the SDK side).

I have a question whether it can perform SDK to release/use the NFC feature or not, so that I can use NFC feature from my app properly.

:waving_hand: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

Additional Documentation

Enable Google Pay
Build on Android
Mobile Payments SDK

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

The Mobile Payments SDK on Android is designed to handle NFC (Near Field Communication) for contactless payments, which might cause conflicts if your app also tries to use NFC simultaneously. Unfortunately, the SDK does not provide a direct way to release or share the NFC feature with other parts of your application while it is in use for payment processing.

To manage this, you might consider structuring your app’s workflow to ensure that NFC operations required by your app and the SDK do not overlap in time. For instance, you could complete any NFC operations your app needs before initiating the payment process with the SDK, or vice versa. This way, you can avoid resource conflicts by ensuring that only one process is using NFC at any given time.

This answer was reviewed by @Bryan-Square.

My structuring app is always uses NFC on every screen and releases it every time navigation between screens, also created with the new screen for the square payment purpose (I initialized SDK here and also not using my own NFC usage), the problem is when payment is completed and navigate back to previous screen, it cannot use own NFC because of square nfc still using and not release the resource yet.

I’m not sure if SDK cannot release NFC resource by itself, so can I just deactivate SDK instead when my operation is completed, and start over again for the new payment operation

Does the SDK ever release the NFC after a short delay? :slight_smile: