Class Overview
This class provides APIs to Near Field Communication (NFC) Settings capability.
Summary
Public Methods |
boolean
|
allowNFCStateChange(boolean allow)
API to allow or disallow the user to change NFC state (turn on or off).
|
boolean
|
isNFCStarted()
API to check if NFC is On or Off on Device.
|
boolean
|
isNFCStateChangeAllowed()
API to check if the state of NFC could be changed by user.
|
boolean
|
startNFC(boolean start)
API to turn NFC on or off.
|
[Expand]
Inherited Methods |
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
|
Public Methods
public
boolean
allowNFCStateChange
(boolean allow)
API to allow or disallow the user to change NFC state (turn on or off).
Parameters
allow
| true to allow NFC change, false to disallow |
Returns
true
if successful, else false
Usage
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);
}
|
Permission
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. |
public
boolean
isNFCStarted
()
API to check if NFC is On or Off on Device.
Returns
true
if NFC is ON, false
if NFC is OFF
Usage
An 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);
}
|
public
boolean
isNFCStateChangeAllowed
()
API to check if the state of NFC could be changed by user.
Returns
true
if is allowed change state, false
otherwise.
Usage
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);
}
|
public
boolean
startNFC
(boolean start)
API to turn NFC on or off.
Returns
true
if successful, else false
Usage
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);
}
|
Permission
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. |