Keyguardmanager

Put your problem here if it does not fit any of the other categories.

Keyguardmanager

Postby barrie » Wed Oct 01, 2008 7:07 pm

is there anyone know how to use this class

Or any other method to lock and unlock the keyboard or screen like push menu button.

Thanks
barrie
Junior Developer
Junior Developer
 
Posts: 10
Joined: Wed Oct 01, 2008 7:03 pm

Top

Postby ninor » Wed Oct 01, 2008 8:10 pm

I don't know why, but it crashes.
I used as the documentation tells, but...

In the class I declared:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.         KeyguardManager kgm;
  3.  
  4.         KeyguardLock kl;
  5.  
  6.  
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


In onCreate()
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.      kgm = (KeyguardManager)getSystemService(KEYGUARD_SERVICE);
  3.  
  4.      kl =  kgm.newKeyguardLock(KEYGUARD_SERVICE);
  5.  
  6.  
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


In onResume() and onPause()
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.         @Override
  3.  
  4.         protected void onResume() {                            
  5.  
  6.                 kl.disableKeyguard();
  7.  
  8.                 super.onResume();              
  9.  
  10.         }
  11.  
  12.        
  13.  
  14.         @Override
  15.  
  16.         protected void onPause() {
  17.  
  18.                 kl.reenableKeyguard();
  19.  
  20.                 super.onPause();
  21.  
  22.         }
Parsed in 0.034 seconds, using GeSHi 1.0.8.4


But it crashes either at disableKeyguard() or reenableKeyguard().
A bug?
Image AndDev: Your Android Development Community / Tutorials | Here's my Basic ToolKit
User avatar
ninor
Moderator
Moderator
 
Posts: 180
Joined: Thu Aug 14, 2008 6:30 pm
Location: Barcelona, Spain

Postby plusminus » Wed Oct 01, 2008 9:36 pm

Hm I never really tried this.

The Javadoc is a bit strange:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. <span style="font-size: 134%; line-height: 116%;">public void disableKeyguard()</span>
  2.  
  3. Disable the keyguard from showing. If the keyguard is currently showing, hide it. The keyguard will be prevented from showing again until reenableKeyguard() is called. A good place to call this is from onResume()
  4.  
  5.  
  6.  
  7.  
  8.  
  9. <span style="font-size: 134%; line-height: 116%;">public void reenableKeyguard()</span>
  10.  
  11. Reenable the keyguard. The keyguard will reappear if the previous call to disableKeyguard() caused it it to be hidden. A good place to call this is from onPause()
Parsed in 0.037 seconds, using GeSHi 1.0.8.4


'Show' and 'Hide' are strange names in this context :?

/plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby MrSnowflake » Thu Oct 02, 2008 2:00 pm

Indeed, and though, I had it not crash, it didn't lock my keys...
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 17 guests