I would use a broadcast receiver and register it for a broadcast action like "android.intent.action.SCREEN_ON". When the receiver gets the broadcast action it would then call a service to start your activity. You could also try to use the broadcast action " android.intent.action.SCREEN_OFF" if you needed to do anything before sleeping.
Tom On Fri, Dec 9, 2011 at 4:46 AM, Bamboomy <[email protected]> wrote: > Dears, > > I've looked around a bit on google, stack overflow and the android dev > site but can't find quite what I'm searching for... > > The idea is to implement a lock for android that requires a code to > unlock your device. > > So: > > 1) Normally the app doesn't do anything at all. (this is the easy > part ;-) > 2) If necessary, when the phone/tablet goes to sleep some preparation > code gets executed (but I'm a bit in the dark on this one) > 3) When the device is turned on again, there is an interface which > asks a pin code which needs to be correct to be able to use the phone/ > tablet, it shouldn't be possible to use the phone/tablet unless the > pin code is correct. > (this to prevent unauthorized use of your tablet/phone, this way you > can safely store passwords and the such on sites and apps in your > phone/tablet without worrying that someone without the pin code can > read your mail) > > Strictly speaking the app doesn't need to do anything unless the > tablet returns from sleep mode, > but I can't even find pointers to execute code just then (I'm also not > sure you can do this with the sdk). > > I'm quite confident that when I know how to execute code at that > moment, I could figure out how to lock the device unless the pin code > is correct, > for the moment I'm not worried yet about that part of the application > (I'd come back to the list when I'd need pointers on that after > searching myself.) > > How can I achieve this behavior? > > Thanks for reactions, > > and any pointers/comment is welcome... > > Sander > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

