WifiLockManager
@UnstableApi
class WifiLockManager
Utility class to handle a WifiLock
The handling of wifi locks requires the WAKE_LOCK permission.
The class must be used from a single thread. This can be the main thread as all blocking operations are internally handled on the background Looper thread provided in the constructor.
Summary
Public constructors |
|---|
WifiLockManager(context: Context!, wifiLockLooper: Looper!, clock: Clock!)Creates the wifi lock manager. |
Public functions |
|
|---|---|
Unit |
setEnabled(enabled: Boolean)Sets whether to enable the usage of a |
Unit |
setStayAwake(stayAwake: Boolean)Sets whether to acquire or release the |
Public constructors
Public functions
setEnabled
fun setEnabled(enabled: Boolean): Unit
Sets whether to enable the usage of a WifiLock.
By default, wifi lock handling is not enabled. Enabling will acquire the wifi lock if necessary. Disabling will release the wifi lock if held.
setStayAwake
fun setStayAwake(stayAwake: Boolean): Unit
Sets whether to acquire or release the WifiLock.
The wifi lock will not be acquired unless handling has been enabled through setEnabled.