简体   繁体   中英

How to make sure my app does not conflict with other apps using nfc

I have an app that has the possibility to log in using a Mifare classic 1K nfc chip. Our customers use another app (nedap) that has the same functionality, but with a different card (same type though). If both apps are open and my app is in the foreground they can log in using our nfc tag. However, when the other app is in the foreground and they try to log in using the other nfc chip, that app refuses to log in (it's just stuck in the login screen without error). If only one app is open there are no problems at all.
Is this my fault or is it an error in the other app? If it is my fault, how can I make sure I don't screw with other apps when implementing nfc functionality?

If an app is launched using the foreground dispatch system , only this app handles the NFC traffic:

The foreground dispatch system allows an activity to intercept an intent and claim priority over other activities that handle the same intent.

When your app goes into background you have to disable it:

Also, activities must call disableForegroundDispatch(Activity) before the completion of their onPause() callback to disable foreground dispatch after it has been enabled.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM