How to make our own lock screen in android instead of default lock lock

I have an idea to create my own phone lock application, similar to android lock. I need to display or run my application when the phone boots / reboots / phone, lock / phone and unlock. I do not know how to make the application appear instead of the default lock screen and hide the default lock screen. So my questions are:

  • How to display or launch my application instead of the default lock screen.
  • What

    getWindow().addFlags( WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); 

How is this useful?

  1. What

     public class BootReciever extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction() != null) { if (intent.getAction().equals(Intent.ACTION_USER_PRESENT)) { Intent s = new Intent(context,ViewPagerMainActivity.class); s.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(s); } } } } 

How is this useful?

  1. How do you display the homepage after completing my application?
+6
java android boot lockscreen
Jul 06 '14 at 17:49
source share
1 answer

The codes that you used in step 2 should be used as an answer to your question 1. Link Android Activity is the default lock by default .

In question 2, see related links:

Before answering your question 3, I would like to ask you, do you know about BroadcastReceiver ? In short -

A broadcast receiver (short receiver) is an Android component that allows you to register for system or application events. All registered receivers for an event are reported in Android runtime after this event.

For example, applications may register for the ACTION_BOOT_COMPLETED system event, which is fired after the Android system has finished loading.

Now let's move on to your question 4, you can show the home page programmatically using this code:

 Intent startMain = new Intent(Intent.ACTION_MAIN); startMain.addCategory(Intent.CATEGORY_HOME); startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(startMain); 

Refer: Going to the main screen programmatically

And finally, I would like to provide you with some links that can help you create your own lock screen:

+12
Jul 06 '14 at 18:55
source share



All Articles