net.rim.device.api.io.nfc
Class NFCManager

java.lang.Object
  extended by net.rim.device.api.io.nfc.NFCManager

public final class NFCManager
extends Object

Manages the status of NFC on the device. Allows registration and removal of NFCStatusListener and NFCFieldListener objects. Also provides functionality to determine the currently available or enabled NFC services and the ability to enable NFC on the device. This manager also provides methods to play a generic tone when NFC operations are completed.

Since:
BlackBerry API 7.0.0

Field Summary
static int NFC_ALL
          Constant that indicates all NFC features.
static int NFC_EMBEDDED_SECURE_ELEMENT_CARD_EMULATION
          Constant that identifies NFC embedded secure element card emulation.
static int NFC_EMBEDDED_SECURE_ELEMENT_CARD_EMULATION_PERSISTENT
          Constant that identifies NFC embedded secure element card emulation persistent setting.
static int NFC_NONE
          Constant that indicates no NFC service is available.
static int NFC_TAG_CARD_EMULATION
          Constant that identifies NFC tag or card emulation (non-Secure Element).
static int NFC_TAG_CARD_READER_WRITER
          Constant that indicates an NFC card reader or writer.
static int NFC_UICC_CARD_EMULATION
          Constant that identifies NFC UICC SIM secure element card emulation.
static int NFC_UICC_CARD_EMULATION_PERSISTENT
          Constant that identifies NFC UICC SIM secure element card emulation persistent setting.
 
Method Summary
 void addNFCFieldListener(NFCFieldListener listener)
          Registers an NFCFieldListener object to receive notifications when NFC detects field changes.
static void addNFCStatusListener(NFCStatusListener listener)
          Registers an NFCStatusListener to receive notifications when NFC services are enabled or disabled.
 void doNFCDataTransferAlert()
          Provides a uniform alert to indicate that NFC data transfer is complete, and the device can be moved out of NFC range.
 void enableNFCByPrompt()
          If NFC is disabled, a dialog prompt is displayed asking if the user would like to enable NFC.
 int getAvailableNFCServices()
          Gets the NFC service mask for NFC services that are currently available to this application.
 int getEnabledNFCServices()
          Retrieves the state of NFC functionality.
static NFCManager getInstance()
          Retrieves an instance of the NFCManager object, which provides access to NFC status functionality.
 void playNFCOperationFailureSound()
          Plays the NFC operation failure sound if alerts are permitted by the current profile.
 void playNFCOperationSuccessSound()
          Plays the NFC operation success sound if alerts are permitted by the current profile.
 void removeNFCFieldListener(NFCFieldListener listener)
          Removes a registered NFCFieldListener.
static boolean removeNFCStatusListener(NFCStatusListener listener)
          Removes an NFCStatusListener.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Field Detail

NFC_EMBEDDED_SECURE_ELEMENT_CARD_EMULATION

public static final int NFC_EMBEDDED_SECURE_ELEMENT_CARD_EMULATION
Constant that identifies NFC embedded secure element card emulation.

See Also:
Constant Field Values
Since:
BlackBerry API 7.0.0

NFC_UICC_CARD_EMULATION

public static final int NFC_UICC_CARD_EMULATION
Constant that identifies NFC UICC SIM secure element card emulation.

See Also:
Constant Field Values
Since:
BlackBerry API 7.0.0

NFC_TAG_CARD_EMULATION

public static final int NFC_TAG_CARD_EMULATION
Constant that identifies NFC tag or card emulation (non-Secure Element).

See Also:
Constant Field Values
Since:
BlackBerry API 7.0.0

NFC_TAG_CARD_READER_WRITER

public static final int NFC_TAG_CARD_READER_WRITER
Constant that indicates an NFC card reader or writer.

See Also:
Constant Field Values
Since:
BlackBerry API 7.0.0

NFC_EMBEDDED_SECURE_ELEMENT_CARD_EMULATION_PERSISTENT

public static final int NFC_EMBEDDED_SECURE_ELEMENT_CARD_EMULATION_PERSISTENT
Constant that identifies NFC embedded secure element card emulation persistent setting.

See Also:
Constant Field Values
Since:
BlackBerry API 7.0.0

NFC_UICC_CARD_EMULATION_PERSISTENT

public static final int NFC_UICC_CARD_EMULATION_PERSISTENT
Constant that identifies NFC UICC SIM secure element card emulation persistent setting.

See Also:
Constant Field Values
Since:
BlackBerry API 7.0.0

NFC_ALL

public static final int NFC_ALL
Constant that indicates all NFC features.

Since:
BlackBerry API 7.0.0

NFC_NONE

public static final int NFC_NONE
Constant that indicates no NFC service is available.

See Also:
Constant Field Values
Since:
BlackBerry API 7.0.0


Method Detail

getInstance

public static NFCManager getInstance()
                              throws NFCException
Retrieves an instance of the NFCManager object, which provides access to NFC status functionality.

Returns:
An instance of the NFCManager.
Throws:
SecurityException - If NFC is disabled by an IT policy.
ControlledAccessException - If NFC is disabled by application permissions.
NFCException - If an exception occurs while retrieving the instance.
Since:
BlackBerry API 7.0.0

getEnabledNFCServices

public int getEnabledNFCServices()
                          throws NFCException
Retrieves the state of NFC functionality.

Returns:
A bitwise mask of values (NFC_*) indicating which NFC services are currently enabled.
Throws:
NFCException - If the application cannot retrieve the enabled services.
Since:
BlackBerry API 7.0.0

getAvailableNFCServices

public int getAvailableNFCServices()
                            throws NFCException
Gets the NFC service mask for NFC services that are currently available to this application. Some NFC services may be enabled on the device, but not available to the current application state.

Returns:
A bitwise mask of values (NFC_*) indicating which NFC services are currently available to the calling application.
Throws:
NFCException - If the application cannot retrieve the available services.
Since:
BlackBerry API 7.0.0

addNFCStatusListener

public static void addNFCStatusListener(NFCStatusListener listener)
                                 throws NFCException
Registers an NFCStatusListener to receive notifications when NFC services are enabled or disabled.

Parameters:
listener - The listener object to notify when NFC service availability changes. If the listener was previously registered, this method does nothing.
Throws:
IllegalArgumentException - If NFCStatusListener is null.
NFCException - If there is a problem adding the listener object.
Since:
BlackBerry API 7.0.0

removeNFCStatusListener

public static boolean removeNFCStatusListener(NFCStatusListener listener)
                                       throws NFCException
Removes an NFCStatusListener. If the listener is null, removeNFCStatusListener returns false.

Parameters:
listener - The registered listener object to remove.
Returns:
true if the NFC status listener was removed; false if it wasn't found.
Throws:
NFCException - If the listener cannot be removed successfully.
Since:
BlackBerry API 7.0.0

doNFCDataTransferAlert

public void doNFCDataTransferAlert()
Provides a uniform alert to indicate that NFC data transfer is complete, and the device can be moved out of NFC range.

Since:
BlackBerry API 7.0.0

playNFCOperationSuccessSound

public void playNFCOperationSuccessSound()
Plays the NFC operation success sound if alerts are permitted by the current profile. Applications that want to provide default NFC alert behavior consistent with other BlackBerry applications should call this method.

Since:
BlackBerry API 7.0.0

playNFCOperationFailureSound

public void playNFCOperationFailureSound()
Plays the NFC operation failure sound if alerts are permitted by the current profile. Applications that want to provide default NFC alert behavior consistent with other BlackBerry applications should call this method.

Since:
BlackBerry API 7.0.0

addNFCFieldListener

public void addNFCFieldListener(NFCFieldListener listener)
                         throws NFCException
Registers an NFCFieldListener object to receive notifications when NFC detects field changes.

Parameters:
listener - The listener object to receive notifications when NFC detects field changes.
Throws:
NFCException - If NFC field listener cannot be added.
Since:
BlackBerry API 7.0.0

removeNFCFieldListener

public void removeNFCFieldListener(NFCFieldListener listener)
                            throws NFCException
Removes a registered NFCFieldListener.

Parameters:
listener - The listener that was added to receive notifications when NFC detects field changes.
Throws:
NFCException - If NFC field listener cannot be removed.
Since:
BlackBerry API 7.0.0

enableNFCByPrompt

public void enableNFCByPrompt()
                       throws NFCException
If NFC is disabled, a dialog prompt is displayed asking if the user would like to enable NFC. If user answers 'yes', NFC is enabled, else NFC is left disabled. If NFC is currently enabled, the method does nothing.

Throws:
NFCException - If there is an issue while trying to enable NFC
Since:
BlackBerry API 7.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal