public class Lockscreen extends Object
unlock()
method that will prefer the default
employee if enabled, and otherwise will unlock to the owner employee.
To explicitly unlock to the default employee use unlockDefault()
. Note that this will
fail if the default employee is not enabled by the merchant.
To check if the merchant has a default employee use the following code:
EmployeeConnector ec; // Obtain an instance in the usual way Employee defaultEmployee = ec.getEmployee(Lockscreen.DEFAULT_EMPLOYEE_ID); boolean isDefaultEmployeeEnabled = defaultEmployee != null;To unlock to a specific employee use
unlock(String)
. To get a list of employees
and their UUIDs use EmployeeConnector.getEmployees()
.
All lock / unlock methods return a boolean indicating if the operation was successful.
Attempting to unlock a device that is already unlocked will fail.
Attempting to lock a device that is already locked will fail.
To understand if a Clover device is currently locked use
com.clover.sdk.v3.employees.EmployeeConnector#getEmployee()
.
This will return either the currently logged in employee, or null
otherwise.
To understand if the merchant has enabled the default employee, use
EmployeeConnector.getEmployee(String)
with and argument
of DEFAULT_EMPLOYEE_ID
.
The behavior of these methods on non-Clover devices and Android emulators differs. On
non-Clover devices, Clover software does not control the lock screen. While the methods in this
class will logout or login Clover employees, they will not cause the device's lock screen
to show or hide.Modifier and Type | Class and Description |
---|---|
static class |
Lockscreen.Contract |
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_EMPLOYEE_ID
An ID for the default employee which is a employee that has no passcode.
|
Constructor and Description |
---|
Lockscreen(Context context) |
Modifier and Type | Method and Description |
---|---|
boolean |
lock()
Lock the device.
|
boolean |
unlock()
Unlock the device as the default employee.
|
boolean |
unlock(String employeeId)
Unlock the device as the given employee UUID.
|
boolean |
unlockDefault()
Unlock the device as the default employee.
|
public static final String DEFAULT_EMPLOYEE_ID
unlockDefault()
,
Constant Field Valuespublic Lockscreen(Context context)
public boolean lock()
public boolean unlock()
unlock(String)
with a null employee ID.public boolean unlockDefault()
public boolean unlock(String employeeId)