An android library which provide lock according to system settings.
- Wifi
- Bluetooth
- Airplane Mode
- Ring
- Location
- Auto Rotate
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add the dependency
dependencies {
implementation 'com.github.Abhishek0706:SecretLockLibrary::0.0.2'
}
SecretLock secretlock = new SecretLock();
The library have three methods
This method return true if the lock is open.
Boolean isLockOpen = secretLock.getLockValue(getApplicationContext());
It opens an AlertBox in which user can change the settings
secretLock.openSettings(YourActivity.this);
This method is used to change the settings Programatically. It takes Hashmap<String,Boolean> as one of argument. String can be one of the following values.
Setting(String) | Default value(Boolean) |
---|---|
wifi_status | false |
bluetooth_status | false |
airplanemode_status | false |
ring_status | true |
gps_status | false |
rotate_status | false |
The default Settings look like this:
Hashmap<String,Boolean> myMap = new Hashmap<>();
myMap.put("wifi_status",true);
myMap.put("bluetooth_status",true);
secretLock.setPreferenceValue(YourActivity.this, myMap);
for getting the value of lock every second, you can call getLockValue()
method using Handler in android. For example refer here.