Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to start activity after unlock btn press & before unlock screen appear?
    primarykey
    data
    text
    <p>I want to do as below:</p> <p>User press hard unlock button. After pressing unlock button my activity is start. After close my activity using close button on screen user prompt to enter pattern lock(or pin lock). after enter right pattern lock home screen appear.</p> <p>I want below scenario:</p> <p>press power/unlock button -> start my activity -> click close button of activity -> prompt to enter pattern for unlock -> enter pattern -> display home screen</p> <p>Currently Done as below:</p> <p>Using Broadcast Receiver of <code>ACTION_USER_PRESENT</code> I got the activity after user enter pattern &amp; device is unlock</p> <p>Using Broadcast Receiver of <code>ACTION_SCREEN_ON</code>, I got the msg on log after unlock button press but activity is start after user enter pattern &amp; device is unlock.</p> <p>I try using Broadcast Receiver to receive event of <code>ACTION_SCREEN_ON</code> and <code>ACTION_USER_PRESENT</code>.</p> <p>My Code is as Below:</p> <p>Broadcast Receiver - </p> <pre><code>public class BrodcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Log.d("receiver", "main"); if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) { // do whatever you need to do here Log.d("receiver", "screen off"); } else if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) { // and do whatever you need to do here Log.d("receiver", "screen on"); context.startActivity(new Intent(context, unlock_image.class) .setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) .setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); Log.d("receiver", "aft activity"); } else if (intent.getAction().equals(Intent.ACTION_USER_PRESENT)) { Log.d("receiver", "unlock"); context.startActivity(new Intent(context, unlock_image.class) .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); } } </code></pre> <p>Register Broadcast Listner - </p> <pre><code>IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_ON); filter.addAction(Intent.ACTION_SCREEN_OFF); filter.addAction(Intent.ACTION_USER_PRESENT); BroadcastReceiver mReceiver = new BrodcastReceiver(); registerReceiver(mReceiver, filter); </code></pre> <p>I try lots but I can't get what I want. Any help is appreciated if any one have idea, How to get expected result as I want.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload