Package com.yubico.yubikit.android
Class YubiKitManager
java.lang.Object
com.yubico.yubikit.android.YubiKitManager
Starting point for YubiKey device discovery over both USB and NFC.
Use this class to listen for YubiKeys and get a
YubiKeyDevice
reference.-
Constructor Summary
ConstructorsConstructorDescriptionYubiKitManager
(android.content.Context context) Initialize instance ofYubiKitManager
YubiKitManager
(UsbYubiKeyManager usbYubiKeyManager, NfcYubiKeyManager nfcYubiKeyManager) Initialize an instance ofYubiKitManager
, providing the USB and NFC YubiKey managers to use for device discovery. -
Method Summary
Modifier and TypeMethodDescriptionvoid
startNfcDiscovery
(NfcConfiguration nfcConfiguration, android.app.Activity activity, com.yubico.yubikit.core.util.Callback<? super NfcYubiKeyDevice> listener) Subscribe on changes that happen via NFC and detect if there any Yubikeys tags got passedvoid
startUsbDiscovery
(UsbConfiguration usbConfiguration, com.yubico.yubikit.core.util.Callback<? super UsbYubiKeyDevice> listener) Subscribe on changes that happen via USB and detect if there any Yubikeys got connectedvoid
stopNfcDiscovery
(android.app.Activity activity) Unsubscribe from changes that happen via NFCvoid
Unsubscribe from changes that happen via USB
-
Constructor Details
-
YubiKitManager
public YubiKitManager(android.content.Context context) Initialize instance ofYubiKitManager
- Parameters:
context
- application context
-
YubiKitManager
public YubiKitManager(UsbYubiKeyManager usbYubiKeyManager, @Nullable NfcYubiKeyManager nfcYubiKeyManager) Initialize an instance ofYubiKitManager
, providing the USB and NFC YubiKey managers to use for device discovery.- Parameters:
usbYubiKeyManager
- UsbYubiKeyManager instance to use for USB communicationnfcYubiKeyManager
- NfcYubiKeyManager instance to use for NFC communication
-
-
Method Details
-
startUsbDiscovery
public void startUsbDiscovery(UsbConfiguration usbConfiguration, com.yubico.yubikit.core.util.Callback<? super UsbYubiKeyDevice> listener) Subscribe on changes that happen via USB and detect if there any Yubikeys got connectedThis registers broadcast receivers, to unsubscribe from receiver use
stopUsbDiscovery()
- Parameters:
usbConfiguration
- additional configurations on how USB discovery should be handledlistener
- listener that is going to be invoked upon successful discovery of key session or failure to detect any session (lack of permissions)
-
startNfcDiscovery
public void startNfcDiscovery(NfcConfiguration nfcConfiguration, android.app.Activity activity, com.yubico.yubikit.core.util.Callback<? super NfcYubiKeyDevice> listener) throws NfcNotAvailable Subscribe on changes that happen via NFC and detect if there any Yubikeys tags got passedThis registers broadcast receivers and blocks Ndef tags to be passed to activity, to unsubscribe use
stopNfcDiscovery(Activity)
- Parameters:
nfcConfiguration
- additional configurations on how NFC discovery should be handledlistener
- listener that is going to be invoked upon successful discovery of YubiKeys or failure to detect any device (setting if off or no nfc adapter on device)activity
- active (not finished) activity required for nfc foreground dispatch- Throws:
NfcNotAvailable
- in case if NFC not available on android device
-
stopUsbDiscovery
public void stopUsbDiscovery()Unsubscribe from changes that happen via USB -
stopNfcDiscovery
public void stopNfcDiscovery(android.app.Activity activity) Unsubscribe from changes that happen via NFC- Parameters:
activity
- active (not finished) activity required for nfc foreground dispatch
-