Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8793163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:05:18+00:00 2026-06-13T23:05:18+00:00

I want to do as below: User press hard unlock button. After pressing unlock

  • 0

I want to do as below:

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.

I want below scenario:

press power/unlock button -> start my activity -> click close button of activity -> prompt to enter pattern for unlock -> enter pattern -> display home screen

Currently Done as below:

Using Broadcast Receiver of ACTION_USER_PRESENT I got the activity after user enter pattern & device is unlock

Using Broadcast Receiver of ACTION_SCREEN_ON, I got the msg on log after unlock button press but activity is start after user enter pattern & device is unlock.

I try using Broadcast Receiver to receive event of ACTION_SCREEN_ON and ACTION_USER_PRESENT.

My Code is as Below:

Broadcast Receiver –

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));
        }     
    }

Register Broadcast Listner –

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);  

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:05:18+00:00Added an answer on June 13, 2026 at 11:05 pm

    Try adding WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED for your activity to be started, this will temporarily disable keyguard/keylock as long as your activity is on top of all other windows.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to replace refresh button with activity indicator when the user press the
I want the user to press a button, where AJAX load will load Google
I want to build a user interface similar to the sketch below: When the
I want to validate below data using regex and python. Below is the dump
i want a mechanism in my web app as described below: user will enter
By Long Press, I mean pressing a button / panel and hold for a
Hi I want to do something like on screen keyboard. I want user to
I am using an Infragistics UltraWinGrid v9.1. I want to allow the user to
I want to create 1 edit text with the below condition: - User can
First Table is the View and Second is the result I want This below

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.