1. Are you ready for the Galaxy S20? Here is everything we know so far!

start app with power button

Discussion in 'Android Development' started by drcspy, Apr 26, 2012.

  1. drcspy

    drcspy Lurker
    Thread Starter

    Hello people

    New to android programming and I would like to create an app that runs when the power button is pressed (the phone will already be 'on' as such but the screen 'off')

    so - one press of the power button to 'activate/show' the screen will make the app run (without requireing the user to unlock the screen please).

    is this possible

    how do I capture the 'power button press' event and then direct it to run *app xxx*

    I thank you for your time in lookin at my question and I sincerely hope I can also one day help others (I have a fairly extensive history online of helping people with windows and hardware issues)

    1. Download the Forums for Android™ app!


  2. sohguanh

    sohguanh Android Enthusiast

    As usual most ppl will recommend you to master Tasker. For your case it will be like what you say, if power on button then start app xx. Some recommend Llama though.

    Btw I am curious why you need such behavoir? You want to track how many times the user power on the button in some background service?
  3. Unforgiven

    Unforgiven ...eschew obfuscation...

    I've moved this to the application development forum so you can get some better eyes on it.:)
    drcspy likes this.
  4. drcspy

    drcspy Lurker
    Thread Starter

    sohguanh nope I'm just wanting to activate an app that uses voice to notify the user of an event/process/ etc wihtout having to log in to the screen as such

Share This Page