java.lang.Object | |
↳ | com.samsung.android.knox.nfc.NfcPolicy |
This class provides APIs to Near Field Communication (NFC) Settings capability.
API level 11 |
MDM 5.0 |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Deprecated
in API level 38
| |||||||||||
Deprecated
in API level 38
| |||||||||||
Deprecated
in API level 38
| |||||||||||
Deprecated
in API level 38
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Deprecated in API level 38
API to allow or disallow the user to change NFC state (turn on or off).
allow | true to allow NFC change, false to disallow |
---|
true
if successful, else false
SecurityException | If caller does not have required permissions |
---|
An administrator can use this API to allow or disallow the user to change the NFC
state. If set to false (disable), the user will not be able to change NFC state. The S-Beam
feature which depend on this policy will not be affected by this setting. This feature does
not change the current state of the NFC Adapter. To change NFC state, check
startNFC(boolean) .
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); NFcPolicy nfcPolicy = edm.getNfcPolicy(); try { boolean result = nfcPolicy.allowNFCStateChange(true); if (true == result) { // NFC state change is not allowed by user. } } catch (SecurityException e) { Log.w(TAG, "SecurityException: " + e); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_HW_CONTROL" permission with a protection level of signature. |
API level 11 |
MDM 5.0 |
Global Scope |
Deprecated in API level 38
API to check if NFC is On or Off on Device.
true
if NFC is ON, false
if NFC is OFFAn administrator can use this API to check if NFC is turned On or Off.
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); NFcPolicy nfcPolicy = edm.getNfcPolicy(); try { boolean result = nfcPolicy.isNFCStarted(); if (true == result) { // NFC Adapter is ON. } } catch (SecurityException e) { Log.w(TAG, "SecurityException: " + e); } |
API level 11 |
MDM 5.0 |
Global Scope |
Deprecated in API level 38
API to check if the state of NFC could be changed by user.
true
if is allowed change state, false
otherwise.An administrator can use this API to check the user is allowed or not to change the
NFC State(ON/OFF).
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); NFcPolicy nfcPolicy = edm.getNfcPolicy(); try { boolean result = nfcPolicy.isNFCStateChangeAllowed(); if (true == result) { // NFC is state is allowed and can be enabled by user. } } catch (SecurityException e) { Log.w(TAG, "SecurityException: " + e); } |
API level 11 |
MDM 5.0 |
Global Scope |
Deprecated in API level 38
API to turn NFC on or off.
true
if successful, else false
SecurityException | If caller does not have required permissions |
---|
An administrator can use this API to turn NFC on or off. If set to false , NFC will be
turned off. If set to true , NFC will be turned on. The S-Beam feature which depends on this
policy will also be affected by this setting.
EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context); NFcPolicy nfcPolicy = edm.getNfcPolicy(); try { boolean result = nfcPolicy.startNFC(true); if (true == result) { // NFC adapter is turned on } } catch (SecurityException e) { Log.w(TAG, "SecurityException: " + e); } |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_HW_CONTROL" permission with a protection level of signature. |
API level 11 |
MDM 5.0 |
Global Scope |