user1767260 user1767260 - 6 months ago 19
Android Question

Android - Show lock screen when application resumes in android

I need to show a lock screen when application comes from background and also after a time duration. I have searched a lot. But not found any useful solution. Please help me. Thanks in advance.


From your added information in the comments, I'd suggest you have one base activity that implements your desired behavior and have your other activities inherit from that one.

It could look somewhat like this:

public class BaseActivity extends Activity{

    public void onResume()
        // check if you want to display your login

If you want to show your login after a set amount of time of inactivity, you could implement that in BaseActivity, too:

public void onUserInteraction(){
    // reset your timer...