ANJYR
ANJYR

Reputation: 2623

On/Off NFC system setting through Phonegap

I am using chariotsolution's nfc plugin for phonegap (https://github.com/chariotsolutions/phonegap-nfc) and it's all working perfect for reading Nfc Tag. In my application there is toggle button that want to On/Off NFC system setting through programmatically in phonegap. Is that possible with an app?

There is method, to show setting but not to On/Off.

nfc.showSettings();

Upvotes: 0

Views: 805

Answers (1)

doncoleman
doncoleman

Reputation: 2283

You can't programmatically turn NFC on and off. The nfc.showSettings function starts an intent that opens the NFC settings so the user can enable (or disable) NFC. https://github.com/chariotsolutions/phonegap-nfc#nfcshowsettings

Use nfc.enabled to check if NFC is enabled. https://github.com/chariotsolutions/phonegap-nfc#nfcenabled

Both of these functions wrap the Android NFC APIs https://developer.android.com/reference/android/nfc/NfcAdapter.html#isEnabled()

Upvotes: 1

Related Questions