Do you want to unlock your device after some interval then you can do that by using following procedure -
You have to create a alarm manager that will trigger after sometime of interval and then you can use KayguardManager class of android that is use to lock and unlock android device.
KeyguardManager km = (KeyguardManager) context
.getSystemService(Context.KEYGUARD_SERVICE);
final KeyguardManager.KeyguardLock kl = km
.newKeyguardLock("MyKeyguardLock");
kl.disableKeyguard();
PowerManager pm = (PowerManager) context
.getSystemService(Context.POWER_SERVICE);
WakeLock wakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK
| PowerManager.ACQUIRE_CAUSES_WAKEUP
| PowerManager.ON_AFTER_RELEASE, "MyWakeLock");
wakeLock.acquire();
here PowerManager class used to indicate that our application needs to have the device stay on.
for this you have to add a permission in your manifest file like this :
android.permission.WAKE_LOCK
0 Comment(s)