public class NfcController extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
NfcController.Callbacks
This interface provide callback methods for
NfcController class. |
Modifier and Type | Method and Description |
---|---|
OffHostService |
defineOffHostService(String description,
String SEName)
Create a new "Off-Host" service.
|
void |
deleteOffHostService(OffHostService service)
Delete an existing dynamically created "Off-Host" service.
|
void |
disableCardEmulationMode(NfcController.Callbacks cb)
Deprecated.
When NFC controller supports HCE and Application ID (AID) routing
|
void |
enableCardEmulationMode(NfcController.Callbacks cb)
Deprecated.
When NFC controller supports HCE and Application ID (AID) routing
|
void |
enableNfcController(NfcController.Callbacks cb)
Asks the system to enable the NFC Controller.
|
static void |
getDefaultController(Context context,
NfcController.Callbacks cb)
Helper for getting an instance of the NFC Controller.
|
OffHostService |
getDefaultOffHostService()
Return the "Off-Host" service related to the current selected "Tap&Pay" menu entry.
|
OffHostService[] |
getOffHostServices()
Return the list of "Off-Host" services belonging to the calling application
(defined through the Manifest or created dynamically). |
boolean |
isCardEmulationEnabled()
Check if the Card Emulation mode is enabled or disabled.
|
boolean |
isEnabled()
Check if the NFC Controller is enabled or disabled.
|
public static void getDefaultController(Context context, NfcController.Callbacks cb)
context
- Calling application's contextcb
- Callback interfacepublic boolean isEnabled()
true
if the NFC adapter is enabled; false
otherwisepublic void enableNfcController(NfcController.Callbacks cb)
cb
- Callback interfacepublic boolean isCardEmulationEnabled()
true
if the Card Emulation mode is enabled; false
otherwisepublic void enableCardEmulationMode(NfcController.Callbacks cb)
cb
- Callback interfaceIllegalStateException
- Indicate that NFC Controller is not enabled.SecurityException
- Application is not allowed to use this API.public void disableCardEmulationMode(NfcController.Callbacks cb)
cb
- Callback interfaceSecurityException
- Application is not allowed to use this API.public OffHostService defineOffHostService(String description, String SEName)
OffHostService.commit()
is called.description
- Description of the "Off-Host" serviceSEName
- Secure Element name holding the "Off-Host" serviceOffHostService
classIllegalArgumentException
- Method is invoked with null
or an illegal argument.UnsupportedOperationException
- Indicate that Host Card Emulation (HCE) is not supported.public void deleteOffHostService(OffHostService service)
OffHostService.commit()
is called.service
- Instance of an OffHostService
class to be deletedIllegalArgumentException
- Method is invoked with null
or an illegal argument.UnsupportedOperationException
- Indicate that the service has been defined through the Manifest and cannot be deleted.public OffHostService[] getOffHostServices()
OffHostService
instances or null
if no such instance exists.public OffHostService getDefaultOffHostService()
OffHostService
instancenull
if the "Tap&Pay" menu entry has not been created by the calling application.