Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • unlock your android phone programatically

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 485
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: