Skip to content

What’s New in MLProduct 2.0

New Unlock Commands:

2.0 introduces three new unlock commands that all drive the LockState’s component MechanismState(s) that are emitted from the onLockStateChange delegate:

mLProduct.unlock(int seconds, MLCommandCallback<String> callback): Queues an unlock command on the Primary Mechanism with an automatic relock duration of the number of seconds passed, or the default automatic relock configuration on the lock if zero is passed.

mLProduct.unlock(MechanismOptions mechanism, int seconds, MLCommandCallback<String> userCallback): Queues an unlock command on the provided mechanism with an automatic relock duration of seconds, or the default automatic relock duration on the lock if zero is passed.

mLProduct.unlock(MechanismOptions mechanism, MLCommandCallback<String> callback): Queues an unlock command on the provided mechanism the default automatic relock configuration duration on the lock.

When any of these commands are called, the MechanismState is automatically transitioned to PendingUnlock. When the mechanism is successfully unlocked, the MechanismState transitions to an Unlocked state, with a countdown value of the automatic relock interval. The countdown value will automatically begin to decrement until the lock is opened or the countdown expires.

Accessing LockState snapshots

  • mlProduct.state() provides a snapshot of the current LockState. Changes to this state are broadcast through he IMLProductDelegate’s onLockStateChange() method.
  • mlProduct.isVisible() provides a shortcut to calling product.state().getVisibility().equals(Visibility.Visible)
  • mlProduct.mechanismOptions() provides a snapshot of known MechanismOptions for a lock. Note that this will return an empty list if this MLProduct has not yet established a session with the lock (e.g. only after didConnect()). This is useful for use cases where you may not know which type of lock your lock will encounter.

Changes to MLProduct.autoDisconnect and KeepAlive

Like in previous versions of the SDK, if you set an mlProduct.autoDisconnect field to “false”, the SDK will extend the length of a session with a lock beyond the command queue being emptied by issuing keep alive commands. This allows the Android SDK to overcome higher latency between disconnects and reconnects when compared to iOS.

mLProduct.setKeepAliveIntervalSeconds(int keepAliveIntervalSeconds): allows you to set the duration of the KeepAlive period, down to a minimum of four seconds. (In previous versions, the duration of the KeepAlive period was always thirty seconds, or until the autoDisconnect parameter was changed.)