thsecmaniac
thsecmaniac

Reputation: 73

How to turn off/disable NFC programmataically?

How to write an application that turn off/disable NFC programmatically when I close my application or when my application is idle?

Upvotes: 2

Views: 5222

Answers (1)

ozbek
ozbek

Reputation: 21183

If you really have to turn NFC off, use NfcAdapter.disable();.

However, you won't be able to use disable() API if your app is not system application which is build together with the platform.

Alternatively, you may show a notice (a dialog?) to the user and ask her if she wants to turn off the NFC. If user agrees, you can redirect her to global Settings UI using following Intent:

startActivity(new Intent("android.settings.NFC_SETTINGS"));

Upvotes: 6

Related Questions