mirror of
https://github.com/wesaphzt/privatelock.git
synced 2025-04-21 06:59:09 +00:00
check for admin
This commit is contained in:
parent
1cc68f0fff
commit
18018360d3
1 changed files with 9 additions and 2 deletions
|
@ -229,13 +229,20 @@ public class LockService extends JobIntentService {
|
|||
|
||||
if (total > SENSITIVITY) {
|
||||
try {
|
||||
if (isActiveAdmin()) {
|
||||
mDPM.lockNow();
|
||||
} else {
|
||||
Toast.makeText(context, "Device admin not enabled", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Toast.makeText(context, "Error locking, does app have device admin permissions?", Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(context, "Unknown locking error", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private boolean isActiveAdmin() {
|
||||
return mDPM.isAdminActive(mDeviceAdmin);
|
||||
}
|
||||
|
||||
private void setNotification() {
|
||||
//notification
|
||||
|
|
Loading…
Add table
Reference in a new issue