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 7084373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:17:36+00:00 2026-05-28T07:17:36+00:00

i want to create such application in android which will be activated when i

  • 0

i want to create such application in android which will be activated when i press sleep or power button twice , is it possible to do that , by running an application in background and listening events from power button ?

some times phone gets into sleep mode once it is idle , and to use any application user has to press
sleep button and then he has to enter certain password to activate the phone. But i want to make make it activate my application when a power button is clicked without any other intervention

  • 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-05-28T07:17:37+00:00Added an answer on May 28, 2026 at 7:17 am

    You can try this trick .

    Register a Broadcast Receiver which is initiated when powerbutton is clicked.
    Now in OnReceive method of the Receiver do what you want.

    For example:

    in manifest file register a receiver:

     <receiver android:name="com.test.check.MyReceiver">
            <intent-filter>
                <action android:name="android.intent.action.SCREEN_OFF"></action>
                <action android:name="android.intent.action.SCREEN_ON"></action>
                <action android:name="android.intent.action.ACTION_POWER_CONNECTED"></action>
                <action android:name="android.intent.action.ACTION_POWER_DISCONNECTED"></action>
                 <action android:name="android.intent.action.ACTION_SHUTDOWN"></action>
            </intent-filter>
        </receiver>
    

    && in onReceive() method of the Receiver

     public class MyReceiver extends BroadcastReceiver {
    
        @Override
        public void onReceive(Context arg0, Intent arg1) {
            // TODO Auto-generated method stub
    
             Log.v("#@%@%#", "Power button is pressed.");  
    
             Toast.makeText(arg0, "power button clicked",Toast.LENGTH_LONG).show();
    
            //perform what you want here
        }
    }
    

    Now perform any operation in onReceive() method of the Receiver.

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

Sidebar

Related Questions

I want to create an MSI in WiX such that it can take a
I want to create a layout in such a way that on top edittext
I want to write an Android remote control application that allows people to navigate
Hi i want to create an application that works like spring quartz i can
I am planning to create an application in android which has following features Show
I am planning to create a small research web application, that will have a
If I would want to create a c# application that support multiple languages, how
I want to store documents with metadata in a web application such that a
I want to create a web application that executes the command below on a
I want to create an application which creates a VPN between some endpoints, something

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.