public class ScannerManager
extends java.lang.Object
implements android.arch.lifecycle.LifecycleObserver
ScannerManager class is responsible for handling the scanned QR code or barcode data
that is passed via a ScannerData object. ScannerManager supports all formats of
scanned data. You do not have to worry about what kinds of data that you have scanned; the
scanned data must simply be passed as a ScannerData object for the SDK to consume.
Hence, the ScannerManager can be thought of as a black box. To receive the result, a
ScannerManager.Callback must be provided. If there is any exception thrown (e.g. due to a badge
condition restriction, network connection issue, etc.), ScannerManager.Callback.onError(DomainException)
will be called.
ScannerManager supports many use cases. These include:
ScannerData object as optional attributes.
Here is more detail on the following use cases:
1. Recover a badge by scanning the QR code that is shown in the badge recovery email.
ScannerManager.Callback.onSuccess(List) will be called with a List of BadgeEntity
objects. The only requirement for this use case is that the ScannerData object contains
the QR code content in ScannerData.content().
2. Validate a badge QR code by scanning the QR code that is generated by
UsherCodeEntity.qrCode(). A valid QR code indicates a valid badge and
ScannerManager.Callback.onSuccess(BadgeEntity) will be called with the corresponding BadgeEntity
object.
3. Conduct physical access by scanning the QR code that is shown at the entrance of certain
physical doors or elevators. If access is granted, ScannerManager.Callback.onAccessGranted(String)}
will be called with the resource name. If access is denied,
ScannerManager.Callback.onAccessDenied(String)} will be called with the resource name.
4. Conduct logical access by scanning the QR code that is shown on a web SSO login page.
If access is granted, ScannerManager.Callback.onAccessGranted(String)} will be called with the resource
name. If access is denied, ScannerManager.Callback.onAccessDenied(String)} will be called with the
resource name. If access requires user confirmation,
ScannerManager.Callback.onPermissionRequired(String, String)} will be called with the corresponding
badge and organization name. In this case, it is recommended to show a dialog for users to
confirm the action. After the user's confirmation, you can create a new ScannerData
object with ScannerData.permissionGranted() set to true.
5. Access Network Manager by scanning the QR code that is shown on the Network Manager portal.
This is a similar to normal logical access, except that you might be required to choose a badge
to confirm login, if you have more than one admin badge installed on your device. Once a badge is
selected, you can specify the corresponding badge by creating a new ScannerData object
with ScannerData.badgeId() set to the selected badge ID.
6. Upload the scanned data to MicroStrategy Identity Server for analytics. If the network
administrator has turned on the option in Network Manager for collecting third party barcode
data, you can upload the scanned data to MicroStrategy Identity Server by simply creating a
ScannerData object with the content. You can specify the type of your QR code with
ScannerData.type(). If there is no badge that is configured to collect generic QR code
data, ScannerManager.Callback.onError(DomainException) with error code
DomainException.NO_BADGE_CONFIGURED_FOR_SCANNED_DATA will be returned.
| Modifier and Type | Class and Description |
|---|---|
static interface |
ScannerManager.Callback
An object that wraps the callback for
ScannerManager. |
| Constructor and Description |
|---|
ScannerManager(android.support.v7.app.AppCompatActivity appCompatActivity,
ScannerManager.Callback callback)
Constructor for a
ScannerManager object with the lifecycle and callback set. |
ScannerManager(android.support.v4.app.Fragment fragment,
ScannerManager.Callback callback)
Constructor for a
ScannerManager object with the lifecycle and callback set. |
ScannerManager(android.arch.lifecycle.Lifecycle lifecycle,
ScannerManager.Callback callback)
Constructor for a
ScannerManager object with the lifecycle and callback set. |
| Modifier and Type | Method and Description |
|---|---|
void |
consumeData(ScannerData data)
Consumes the
ScannerData object. |
@Inject
public ScannerManager(@Nonnull
android.arch.lifecycle.Lifecycle lifecycle,
@Nonnull
ScannerManager.Callback callback)
ScannerManager object with the lifecycle and callback set.lifecycle - See Lifecyclecallback - the callback when ScannerManager consumes the ScannerDatapublic ScannerManager(@Nonnull
android.support.v7.app.AppCompatActivity appCompatActivity,
@Nonnull
ScannerManager.Callback callback)
ScannerManager object with the lifecycle and callback set.appCompatActivity - See AppCompatActivitycallback - the callback when ScannerManager consumes the ScannerDatapublic ScannerManager(@Nonnull
android.support.v4.app.Fragment fragment,
@Nonnull
ScannerManager.Callback callback)
ScannerManager object with the lifecycle and callback set.fragment - See Fragmentcallback - the callback when ScannerManager consumes the ScannerDatapublic void consumeData(@Nonnull
ScannerData data)
ScannerData object. Will analyze the type of the scanned data and then
1) save the content if it is a non-MicroStrategy Badge QR code or 2) process the QR code if
it is a MicroStrategy Badge QR code.data - See ScannerData