[Q] start app with power button - General Questions and Answers

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)

Related

Single press device Lock

Folks, any idea how to switch off the screen / lock the keyboard without the need of double press the red power button?
This is kind of bothering cause when you're in a application and need quickly to put your Treo into your pocket, you need to press 1st to get to the home-screen and 2nd to switch off.
Yeah, seems to be something new with the 750 (no other treo before did this). Palm set this up purposely, so I wouldn't assume there's a workaround for it. You'll get used to double clicking
Not that I know
I have used it for ages and found many shortcuts but no "quick lock".
Sorry
How about getting an application that device locks your phone upon return from standby? I use BatteryStatus Today Plugin by Chi Tai Dang.. This plugin has the option to lock device on wakeup and set cpu speed(I use this a lot)..
But mine's a wizard, what do I know about Treo.. but what I do now is, press the power button to get the phone to go into standby and when I want to use it again, I press the power button and it will device lock upon wake up.
I don't have a Treo. How do you initiate said keyboard lock normally?
V
vijay555 said:
I don't have a Treo. How do you initiate said keyboard lock normally?
V
Click to expand...
Click to collapse
"Device lock" that you may know of isn't used on Treo's. Palm uses their own "keyguard," which uses the red END button as a power button when not on the phone. If you are on the today screen, one click will shut the device off. However, if you are in another program, the first tap brings you to the today screen, and the second click turns the screen off (and the keyguard on if you have selected it to be that way). On all other treo's, WM or POS, one click of the end button would shut the screen off (unless you were on the phone obviously, it would be the END function), regardless of what program you were in. Palm changed this, I assume, to be like most cell phones, where when you press the END key it returns to the home screen, regardless of what you were doing. Like a RAZR would do.
Thats the best way I can explain it. You would be surprised Vijay on how many customizations Palm made to the OS.
Yes, I've heard that they did - thank Goodness one of the OEMs finally saw fit to do something original.
Hmm.. from what you describe, clicking twice doesn't seem like a very big chore... I did something similar in VJOkButt. Is it really necessary to convert the 2 clicks to 1 click? Investigating it barely seems worth the effort
V
I agree, hence my original post.
When you are on the today screen, it works normally. And you can double-click quite rapidly and it will work. Not a big deal for me.
yes guys, its not that dramatical, but still, it would be an improvement also considering that I want to stay in that one application (a note which I'm editing) and want to get there after waking up the device again without the need of again starting application, look for the last note, opening etc...
with HTC hermes and others the power button works exactly like this and its even better.
Hi all,
If you're using it two handed hold option (the white key, left hand end of row 3) and press the red button once - closes the app and powers off.
But you need an odd-shaped hand to do that one handed!
It is not that the double click isn't easy to do, it's waht fire00 said; if you are in an app, it closes it and then powers off. Case in point, this weekend while driving to a friend's house, I had directions in my email and would have liked to have turned off the phone, but then I would have to find the email again and open it up. On my Wizard, i would just turn it off and then back on and the email would be there for me.
Gotta be a reg hack for someone to find.
mackangus said:
If you're using it two handed hold option (the white key, left hand end of row 3) and press the red button once - closes the app and powers off.
Click to expand...
Click to collapse
On my device, that method doesn't close the app. It just locks the keyboard and then powers off. When I power on again, the app is still running and on screen. I think that's what fire00 was looking for.
pjcace said:
It is not that the double click isn't easy to do, it's waht fire00 said; if you are in an app, it closes it and then powers off. Case in point, this weekend while driving to a friend's house, I had directions in my email and would have liked to have turned off the phone, but then I would have to find the email again and open it up. On my Wizard, i would just turn it off and then back on and the email would be there for me.
Gotta be a reg hack for someone to find.
Click to expand...
Click to collapse
Sorry PJC ACE, my mis-type - using option + red button powers the device off WITHOUT closing the app - just like the power button on the Wizard ;-)
My apologies!
GUYS YOU'RE ABSOLUTE TREO-EXPERTS !!!!!
thanks a lot, going to dance with the Treo cause I'm so haaapyyy !! )))
fire00 said:
GUYS YOU'RE ABSOLUTE TREO-EXPERTS !!!!!
thanks a lot, going to dance with the Treo cause I'm so haaapyyy !! )))
Click to expand...
Click to collapse
Option (hold)+Red Phone button is a nice alternative, but I'd really like to find a way to prevent the Red Phone from reverting to the Today screen, so I can power off directly with it with one press...Vodafone's excuse for specifically asking for it this way (every other phone's "End" button brings you back to the "home" screen) is ridiculous, these aren't like every other phone.
I installed HTC home plugin and now my red button wont let me go into standby. I uninstalled and still not working. Any ideas?
Side Button + Suspend
There is a thread at TreoCentral that explaines how to activate the side button and make it available for button assignment in the settings screen.
Second there is a small program called suspend.
I have mapped the 1 press of the side button to suspend and away we go.
1 - Click keyguards/screen off.
Also it resume in the place or program you left when you unlock it.
Regards

Remove Quick List Action Screen - Feature request

Hello everyone.
The HD2 Power-off procedure takes extremelly long, first perssing the power hardware button for a few seconds, then waiting for the Quick List Action Screen to pop-up, then pressing the Power Off Button on the touch screen.
Id like to request a simple mod the can bypass/eliminate the usless Quick List Action Screen so that (like in most phones) once the Power hardware button is pressed for a couple secinds, the phone shuts down directly with no further confirmations or pop-up lists.
Thanks much
here is something i cobbled together for you from an app i had lying around that can shutdown with no warnings (sorry cannot remember who created it) and a tweak to map it to long press power key.
Extract all three files into your windows folder and long press on power key will power off with no warnings.
THANK YOU!!!!!!!!!!!!!!!!!!!!!!!!!!!!
optiknerv said:
here is something i cobbled together for you from an app i had lying around that can shutdown with no warnings (sorry cannot remember who created it) and a tweak to map it to long press power key.
Extract all three files into your windows folder and long press on power key will power off with no warnings.
Click to expand...
Click to collapse
optiknerv, I have no idea how to thank you enough, but... really, THANK YOU!!! This is exactely what I had been looking for, for the longest time.
Thanks again very much!!!
VeEuzUKY said:
optiknerv, I have no idea how to thank you enough, but... really, THANK YOU!!! This is exactely what I had been looking for, for the longest time.
Thanks again very much!!!
Click to expand...
Click to collapse
no problem I'm always happy to help. i can't take full credit i just brought work by two other people together into what you want. You must be like the cheshire cat from the looks of that post LOL

[Q] Off-Key Widget on Defy?

greetings!
Just recently i got a Motorola Defy, and to be honest the top power button seems a little wimpy.
i have downloaded two apps so far to circumvent the power key;
Tap Tap App and Fix Broken Power Button.
the following problems occur when attempting to power the phone down.
In Fix Broken Power Button the widget is completely inoperative.
in Tap Tap App the screen will flash dark, then immediately come to the lock screen.
i believe this has to do with the Defy's internal workings, and have seen other people have similar problems,
see http://forum.xda-developers.com/archive/index.php/t-1017269.html
is there hope for my phone?
thank you.

Catch Volume-Up in background service

Hello,
i am searching for a long time to find a way for catching double-volume-up key press (like a double click) while the screen is off.
My service runs in background even with the screen off, and gathers some gps coordinates, all i want to do is double-press the volume-up button and start/stop my background service without having to actually unlock the screen.
Any directions, samples, guides, proposals etc would be appreciated.
My phone isn't rooted, i need a method that would work on non rooted phones to actually add this functionality in my app if i decide to upload it to market.
Thank you for your time, i hope someone in here will have a solution on that :/

[Q] Remap volume-up button to power button

Hello all,
Recently the power button on my Nexus 5 has been acting really weird. Sometimes it works flawlessly, others it requires pressing it really hard to work. In order to prevent it to stop working indefinetely, I am looking for a way to remap my volume-up button so it can work as a power button. I don't need it to turn my phone on or to work in the recovery mode (from what I read, it seems to be impossible), only when Android is running.
I've already tried some workarounds:
1) Volume Unlock Power Button Fix app: I tried it, but it just allowed me to turn on my phone with volume but not turning off. Also, it drains a LOT of power.
2) Buttonremapper app: It would theoretically do exactly what I wanted, but did not work at all.
3) Editing generic.kl: I tried switching volume-up and power buttons codes in generic.kl, but also did not work. Maybe I need to modify another file?
3) Xposed Framework + Additions: The installation of Xposed went Ok, but after installing Additions module I got stucked in bootloop. I am running Android 5.1 stock, maybe this module is not yet compatible.
So, can anyone help me? Do I need to install a custom ROM?
PS: I live outside US, so no warranty for me. Otherwise I would just use it
Thanks in advance for any help!
Cheers,
Humberto
Hi folks,
Just a heads up for anyone who might be facing the same issue. I decided to change from stock to Cataclysm ROM due to some specific features (listed below). After the installation, here's what I did to work around this problem:
1) Enabled "Volume wake" and "Sleep button on status bar" in "Cataclysm Settings / Miscellaneous".
2) Enabled "Swipe to sleep" and resized NavBar to 115% in "Cataclysm Settings / Navigation bar options". -> This way I can swipe in NavBar at any time (except lockscreen) to turn off screen. I raised it a little to facilitate the swipe gesture.
3) Changed Lockscreen Dialer shortcut to ""Turn off Screen" app shortcut (just search for it in the play store) in "Cataclysm Settings / Lockscreen options" -> This allows me to just swipe right and turn off the screen when my security settings are disabled (which accounts for most of the time). I found it way faster than pressing sleep button in status bar, especially when I'm driving and I can't look at the screen. Plus, I don't really use the dialer function of my phone so often since the invention of Whatsapp ;P
I realize this is not the perfect solution, but I don't see a better way to deal with this power button malfunction problem (except from a hardware fix).
Hope this helps!
Cheers,
Humberto
PS: I am really enjoying Cataclysm. It's a very nice ROM, completely stable and with a lot of other interesting features aside from the ones mentioned above. I strongly encourage anyone to give it a try!
I'm facing the exact same problem but I really need to eliminate the power button or I will need a power button fix soon.
The solutions you found hthiengo are good if not needing to turn off (or worst: running out of battery, something that happens me sometimes). I'm in the situation that next time I hit power button I will need to replace the button, or throw the nexus away
I did installed the xposed additions for lollipop but it is not working, and the Cataclysm trick is not enough in this case
Ok, after some research I've found a temporary solution:
For the power button you can remap modifying the file gpio-keys.kl under system/usr/keylaout (i wonder why anyone could figure out thise before, no that difficult). I would like to map power button leeaving it useless but I've found it impossible to remap the power button (probably because the key number is not 116). I would have liked to see xposed additions to help me map the keys but is not functional at least for me.
If the phone runs out of battery I've found that if I plug the power cable by pressing both volume buttons at the same time, eventually it starts up with the bootloader so I can plug the pc cable and it will reboot sucessfully.
So despite the phone know is pretty disfunctional (not the best phone for a hurry without battery), I can still use it for some weeks before I plan buying a new one or something (or I find a place for reparing). Its a shame I could not find a better solution for example, ADT when powered off so I could just reboot it by using ADT reboot command while powered off.
And It would be really amazing if the volume up button could also power it on from the powered off state.
In my case the power button is broken, but sometimes it gets stuck and puts the phone in a reboot loop: To avoid pressing the power button accidentally I've made a hole in the protective case so its pretty difficult to access it.
That's all for now. If anyone can make it better I will be glad to hear him/her

Categories

Resources