Android Question a Locker App

marab

Member
Licensed User
Longtime User
hi guys
at the first i'm sorry for my bad English!!
i want to make a locker app like for example go locker or etc
first problem!:
at first i must make app safe mean you can't close it before unlock the app!
i solved problem for home,back key
but my problem is on long press home key in a phone like Xperia ray or multi tasking key in a phone like sony xperia z1
i found this code for java:

B4X:
    public void onWindowFocusChanged(boolean hasFocus) {
        super.onWindowFocusChanged(hasFocus);
   
        //    Log.d("Focus debug", "Focus changed !");
   
        //'if(!hasFocus) {
    //        Log.d("Focus debug", "Lost focus !");
   
            Intent closeDialog = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
            sendBroadcast(closeDialog);
        //}
    }





when i tested this code in Eclipse it work's for ray !but it doesn't work for xperia z1
mean this code close any notification
and its good but it didn't solved the xperia z1 problem mean multi tasking key
now can i use this code in b4a?!how?
and did you have any better answer?


second problem!:
did you have any idea for making a good ,fast and soft patern for password of locker!?



if anyone has any thing about these please say!!
and thanks for reading this tooo long thread!!!!
 

aaronk

Well-Known Member
Licensed User
Longtime User
Why not just use a service ?
When your Activity is paused, then start the service which will then load the activity again.

Only catch is if your unlock code doesn't work, then there isn't a way to end the app unless you reboot your device, and if you make the service start on boot then there wont be a way to ever end the app. (not what I am aware of anyway)

As for the unlock Patten, have you searched the forum for this? There seems to be many posts about this and a library that you can use.
 
Upvote 0

marab

Member
Licensed User
Longtime User
Really thanks to aaronk and Erel
i have thought about the services but i asked maybe a better way can found!
 
Upvote 0
Top