07-29-2008 03:40 PM
Does anyone have the idea to programmatically detect if the Lock Scrren is shown? I want to detect this screen so my application could do special Notifications.
Thanks fro your helps.
Solved! Go to Solution.
07-29-2008 03:55 PM
You might try MemoryCleanerListener. You get a deviceLocked event when the screen is locked.
-de
07-29-2008 04:27 PM
07-29-2008 04:33 PM
07-29-2008 04:36 PM
02-28-2013 04:06 AM
Anyone have successed with that code?
I still get the problem with it, this is my code,
public static void main(String[] args)
{
MakeMeAPrincessApp theApp = new MakeMeAPrincessApp();
theApp.enterEventDispatcher();
MemoryCleanerDaemon.addListener(new MemoryCleanerListener() {
public String getDescription() {
// TODO Auto-generated method stub
return "listener";
}
public boolean cleanNow(int event) {
// TODO Auto-generated method stub
System.out.println("running");
if(event==MemoryCleanerListener.EVENT_DEVICE_LOCK) {
System.out.println("LOCK");
}else{
System.out.println("UNLOCK");
}
return false;
}
});
}please anyone can help me?
02-28-2013 05:59 PM
Hi @MalaWidiyanto
The function "enterEventDispatcher" does not return so you should add your listener (and all your code) before you call it.
E.
03-01-2013 04:14 AM
hi @maadani thank for replay ![]()
I have try to place the "listener" before "enterEventDispatcher" but its look doesn't work,
do you have solution for this problem?
03-01-2013 06:39 AM
Can you post your updated code?
What exactly happen when you are trying to debug your code?
Any errors in the log?
E.
03-01-2013 08:01 AM
@maadani
this is my new code :
public static void main(String[] args)
{
MemoryCleanerDaemon.addListener(new MemoryCleanerListener() {
public boolean cleanNow(int event) {
// TODO Auto-generated method stub
System.out.println("running");
if(event==MemoryCleanerListener.EVENT_DEVICE_LOCK) {
System.out.println("LOCK");
Dialog.inform("LOCK");
}else{
System.out.println("UNLOCK");
}
return false;
}
public String getDescription() {
// TODO Auto-generated method stub
return "listener";
}
});
MakeApp theApp = new MakeApp();
theApp.enterEventDispatcher();
} but not successed yet, whats wrong with my code?
or I must try it in the device? I just tested it on Simulator ![]()
and no an error in the log ...