问题
Is it possible to disable the NFC adapter immediately after a scan within millisecs? I want to prevent duplicate scans of the same tag. I have proved though testing that the same tag can be scanned twice within millisec by hovering the phone over a tag.
I've looked at the NFC api but can't see anything that disables the adapter. My app uses the NFC statically so i don't actually use an instance of the NFC adapter class but i would change my if i could reap the benefits of disabling the adapter.
回答1:
Since you can turn it off in the system settings I would assume there should be a way to do it. It should look something like myAdapter.disable
or myAdapter.disable(something)
Or try this:
http://developer.android.com/reference/android/nfc/NfcAdapter.html#disableForegroundDispatch(android.app.Activity)
来源:https://stackoverflow.com/questions/17721507/nfc-disable-adapter