If I write an app, is it possible to to override the default functionality of the hardware power button?
I only found this on google, but it didn't work:
stackoverflow.com/questions/3703071/how-to-hook-into-the-power-button-in-android
Thank you!
I would be interested in an app to do this, as well as bringing up the power menu as holding the power button usually does.
The power button on my Desire has issues letting go... the phone seems to think that the button is always pressed, effectively making me unable to "press" the button when I want. Pretty certain it is mechanical failure, since if I take the battery out and then put back in, the phone turns on without my doing anything else. So, I cannot shutdown via the power menu... tried apps which use SU to power off/reboot, but they are causing problems with Data2Ext and A2SD+ filesystems. I also cannot do anything from hboot or fastboot... must enter recovery through a root app.. which is not always helpful.
Been looking for several months
Baschdard said:
If I write an app, is it possible to to override the default functionality of the hardware power button?
I only found this on google, but it didn't work:
stackoverflow.com/questions/3703071/how-to-hook-into-the-power-button-in-android
Thank you!
Click to expand...
Click to collapse
I would really like for this too.
I am trying to do an in-dash install of a 7inch tablet and it is unable to sense when the power is removed. I have also tried running Tasker but it says 'Application not installed'.
So I would like to send a pulse to the power button and trigger a shutdown app. Otherwise I will just be cutting power which is sure to corrupt things
It's Needed!!!
Please see my other post in this thread:
http://forum.xda-developers.com/showthread.php?t=1052451
Thanks!!
Related
Is there a way to disable the menu option when long pressing the power button when the phone is in lock mode?
My phone is switching its self off sometimes while in my pocket.
I have tried widget locker but that does the same as the stock screen and still offers this menu while the phone is locked.
I'm using Redmi Note 8 pro Miui 12 Global Rom Android 10 i not found the option sec_key.kl
I can't answer your question directly other than to say you may be blaming the wrong thing - is it really possible that you can keep sustained preasure on the switch for about 8 seconds?
Is it possible that your phone may be rebooting / hanging / freezing in your pocket like mine and many others are?
Have a look here and here to start
Two seconds is enough in my stock lockscreen. So it's very much possible.
Stupid how the shutdown-window is accessible through the lockscreen. Takes away the whole function of this so called lockscreen..
prodygee said:
Two seconds is enough in my stock lockscreen. So it's very much possible.
Stupid how the shutdown-window is accessible through the lockscreen. Takes away the whole function of this so called lockscreen..
Click to expand...
Click to collapse
I agree. For me, it's just under a second. I mean come on. Really?
prodygee said:
Two seconds is enough in my stock lockscreen. So it's very much possible.
Stupid how the shutdown-window is accessible through the lockscreen. Takes away the whole function of this so called lockscreen..
Click to expand...
Click to collapse
But you then have to select "Power off" and then click "OK". Are you suggesting that's happening in your pocket?
naddie said:
I agree. For me, it's just under a second. I mean come on. Really?
Click to expand...
Click to collapse
Tapping or pressing thepower button will bring the swipe screen / lock screen back but this does not stitch off the phone!
From OFF, if I press and hold the power switch, the lock screen comes on, then goes off after 5 seconds. At this point, the phone has not shut down.
From OFF, if I hold the button down for about 9 seconds, it does shut down.
As I said, I don't think this is all that easy to do by accident - maybe even impossible! BTW, my phone is stock.
I'd still say it's the dreaded phantom rebooter
johncmolyneux said:
But you then have to select "Power off" and then click "OK". Are you suggesting that's happening in your pocket?
Click to expand...
Click to collapse
Never mind, you're right about that. I stand corrected. It takes a lot of effort to shut your phone off with the power button, so that can't be the reason OP's phone is shutting off.
http://forum.xda-developers.com/showthread.php?t=1098981
.hide said:
http://forum.xda-developers.com/showthread.php?t=1098981
Click to expand...
Click to collapse
Thanks very much for this
Just removed the wake option from the power button.
To answer a few other posts. The few times it has switched off it has only been while in my jacket pocket. Carrying my niece, seat belt on/off etc. I know it appears difficult to replicate but I have not had any other issues like mentioned in the other forums linked in post 2.
The reason I think its the power button is because I have taken my phone out of my pocket recently and noticed that the menu to shut down has been visable on the screen. I haven't had an issue of it turning off while on a desk etc which is why I think its the power button.
I may be wrong and if it carries on turning off I will look at other options but I do think its silly (how ever hard to replicate) that an option to access the shut down menu while in lock mode is stupid.
By removing the option to wake from the power button and setting widgetlocker to block homehelper there is no way to access the menu the power button had until the phone is unlocked. Which is how the lock screen should work regardless of if it solves my problem or not.
For SGS2 users, I used Root Explorer to edit:
Code:
/System/usr/keylayout/sec_key.kl
I found the following line:
Code:
key 116 POWER WAKE
To disable the Power button from waking up your device, simple delete the word 'WAKE', save the file, and reboot.
Cheers to the others in the HD2 thread for the tip.
same problem with galaxy w
jonamafun said:
For SGS2 users, I used Root Explorer to edit:
Code:
/System/usr/keylayout/sec_key.kl
I found the following line:
Code:
key 116 POWER WAKE
To disable the Power button from waking up your device, simple delete the word 'WAKE', save the file, and reboot.
Cheers to the others in the HD2 thread for the tip.
Click to expand...
Click to collapse
i have the same phantom restart problem......but i cant access the phone to use the root explorer ....wat should i do????
Hi all i made an app to avoid this, blocking power menu on lockscreen no need of root working on 2.2+ and you can set up a custom menu (power and reboot need root) so you should take a look and if you like please leave a 5 stars, or let me know any issues
Play Store Link
zen kun said:
Hi all i made an app to avoid this, blocking power menu on lockscreen no need of root working on 2.2+ and you can set up a custom menu (power and reboot need root) so you should take a look and if you like please leave a 5 stars, or let me know any issues
Play Store Link
Click to expand...
Click to collapse
Nice, this was exactly what I was looking for on my Nexus 4 running 4.3 and Cerberus. Unfortunately only the power off menu is disabled (it just flashes for a millisecond) but long pressing the power button still shuts off the phone...
Sent from my Nexus 4 using Tapatalk 2
itenos said:
Nice, this was exactly what I was looking for on my Nexus 4 running 4.3 and Cerberus. Unfortunately only the power off menu is disabled (it just flashes for a millisecond) but long pressing the power button still shuts off the phone...
Sent from my Nexus 4 using Tapatalk 2
Click to expand...
Click to collapse
yeah, i cant do anything without change whole rom :/ its just a workaround :/
Hello guys. At first i´m so sorry for my bad english, so i´ll show you a video of my problem.
Phone - HTC Hero, Android 2,1
Video:
I can´t post outside links in my messages...
youtube. com/watch?v=V1BwQZsoKCk
It will not go to sleep mode when pressing the end/power key. But it still takes phone OUT of sleep mode, but now I have to wait for the screen timeout instead of pressing the button again.
I tried to find answer to my question, but i failed... I tried Reboot, Spare Parts - i don´t know if it worked properly, Hard reset, but the power button still not working properly.
Thank you! Marty
Restore you phone to the default setting and softares
Sent from my awesome X8 using Tapatalk
I tried that... No results
Marty Chill said:
I tried that... No results
Click to expand...
Click to collapse
Try to restore your phone to the default, or try to install a custom rom
Sent from my awesome X8 using Tapatalk
Now i did a ROOT and i try to flash in some ROMs but it still not works + it cancels my outcoming and incoming calls...
Sounds like you have a failing power button.. like I do.
It's a real pain in the ass... been looking for solutions for quite a while, besides physically replacing the circuit board the button is on...
I know this is old but for anybody researching the same problem... after trying MANY different apps for taking over power button tasks, the only real solution was to buy a replacement "Flex Cable" assembly on eBay. Takes some bravery to install but everything works now.
But that's just my experience.
I suppose that the simplest way out id button remapper that you can find hear at xda.
By using such software you can easily turn any of the other physical keys of your device into the power button.
lucaoldb said:
I suppose that the simplest way out id button remapper that you can find hear at xda.
By using such software you can easily turn any of the other physical keys of your device into the power button.
Click to expand...
Click to collapse
True, and they did work once the phone was up and running. However, when something went wrong on my rom and I needed to get into recovery to re-flash... I was SOL.
Yes, remapping is applied only after the kernel is loaded... So remapping is quite useless if the phone is switched off.
Hi ,
i'm having some problems with my Galaxy S3 - I9300
my baby brother keeps turning my phone off ..
i use a pin code for the lock screen. but that doesnt stop anyone from holding the power button then turning the phone off
is there anyway to disable this menu in lockscreen
also it makes anyone capable of enabling silent mode or airplane mode and i dot want that..
is there any third party lock screens that would disable this menu ...
i really need help !!
thnxx in advance...
Ali5anDro31 said:
Hi ,
i'm having some problems with my Galaxy S3 - I9300
my baby brother keeps turning my phone off ..
i use a pin code for the lock screen. but that doesnt stop anyone from holding the power button then turning the phone off
is there anyway to disable this menu in lockscreen
also it makes anyone capable of enabling silent mode or airplane mode and i dot want that..
is there any third party lock screens that would disable this menu ...
i really need help !!
thnxx in advance...
Click to expand...
Click to collapse
I too would like to know if that is possible
Ive found out that its possible to disable the WAKE function for the power button. This will disable the power menu, but you can still hold the button down for like 6sec and it will shutdown... :-\
Sent from my GT-I9300 using xda app-developers app
No way
Sorry to revive a dead thread, but I want to be able to wake/sleep my phone with the power button, but don't want anyone to be able to access airplane mode or turn the phone off. I have a HTC Desire S, and when that's locked, the power button does absolutely nothing except switch the screen on, which is what I want to happen. As the S3 currently functions this is a maor issue for me, because if anyone finds/steals my phone, there is nothing turning on Airplane mode immediately, at which point my phone becomes unrecoverable.
This seems like a limitation/oversight of touchwiz, is there no way at all I can get the S3 to behave like the Desire?
Ryaninja said:
if anyone finds/steals my phone, there is nothing turning on Airplane mode immediately, at which point my phone becomes unrecoverable.
Click to expand...
Click to collapse
It's not like there's something stopping them from turning it off (hold the button, it's wired in the hw, impossible to disable) or simply taking out the sim card
Glebun said:
It's not like there's something stopping them from turning it off (hold the button, it's wired in the hw, impossible to disable) or simply taking out the sim card
Click to expand...
Click to collapse
It's wired into the hardware? Are you sure about that? The power button on my HTC does absolutely nothing if you press the power button (for any length of time) while the phone is locked. In my opinion it would be software that controls the function of the button.
You make a good point about the sim though - that an the battery being removed would stop me from finding it.
However the main thing I'd like to disable is the airplane mode function from the lockscreen as it literally takes no time at all to do. At least the other methods require a little bit more effort, and the scum that steal phones aren't usually known for their intelligence, so I can always cling to the hope they won't think about taking the back off (since so many phones nowadays have inaccessible guts) to remove the battery or sim, at least not immediately.
Is there anyone who can help with this?
Ryaninja said:
It's wired into the hardware? Are you sure about that? The power button on my HTC does absolutely nothing if you press the power button (for any length of time) while the phone is locked. In my opinion it would be software that controls the function of the button.
You make a good point about the sim though - that an the battery being removed would stop me from finding it.
However the main thing I'd like to disable is the airplane mode function from the lockscreen as it literally takes no time at all to do. At least the other methods require a little bit more effort, and the scum that steal phones aren't usually known for their intelligence, so I can always cling to the hope they won't think about taking the back off (since so many phones nowadays have inaccessible guts) to remove the battery or sim, at least not immediately.
Click to expand...
Click to collapse
I don't think it's any more difficult to steal the phone by diabling the powerbutton functions, but I would still really like to find a way of disabling this function. Although it's meant as an easy way to enter reboot, shutdown and turning on/off misc functions, I don't mind unlocking the phone to do the same things through the slidedown menu.
I just don't like the fact that the phone actually can be turned off by holding a button down for x-amount of seconds, or even open up a menu that lets anyone change the status of the phone. When it's locked it is locked to prevent accidental changes when the phone is in my pocket AND to prevent people from accessing any options, unless they pull the battery and boot to download or recovery.
The powerbutton and the home menu should be allowed to wake the phone up, so that you can read widgets/missed events/the time or whatever, but never let anyone do anything before they enter the correct pattern/password or whatever security is enabled.
Hope that this can be fixed. Been searchin around for weeks after this and would really like to see someone assist us with this issue.
Its a build not a fix wait for SGS4 and see if its been added .
Personally if i had to enter pinlocks as you suggest i would not want this phone .
Development sometimes putting up a large bounty or donating a SGS3 may kick start a modification .
jje
Ryaninja said:
It's wired into the hardware? Are you sure about that?
Click to expand...
Click to collapse
yes
power off the phone and remove the battery for a few seconds and then put it back in. Press your power button and after the phone screen turns on press and hold the volume down button until the phone boots up. It should enter safe mode and display some text near the bottom of the screen.
This loads the phone without any Play Store apps active.
tjamscad said:
power off the phone and remove the battery for a few seconds and then put it back in. Press your power button and after the phone screen turns on press and hold the volume down button until the phone boots up. It should enter safe mode and display some text near the bottom of the screen.
This loads the phone without any Play Store apps active.
Click to expand...
Click to collapse
That's the way it was on the Droid Incredible 2. On the original Dinc, it was Volume Down + Optical joystick. You don't have to remove your battery to do this, though, or even turn the power off. A simple restart works.
IceDragon59 said:
That's the way it was on the Droid Incredible 2. On the original Dinc, it was Volume Down + Optical joystick. You don't have to remove your battery to do this, though, or even turn the power off. A simple restart works.
Click to expand...
Click to collapse
what's the benefit of this besides the apps??
maybe theres a way to hold this key and that key to boot into s-off mode hehehehe!
Aldo101t said:
what's the benefit of this besides the apps??
maybe theres a way to hold this key and that key to boot into s-off mode hehehehe!
Click to expand...
Click to collapse
lol. I wish. Safe mode, as in a desktop operating system, lets you enter the OS without allowing problems plaguing your system from apps or other things generally causing problems. You can uninstall apps or change settings to fix issues. If you're overclocking with an app like SetCPU and having problems, it lets you boot into the OS without the overclock which may be causing the issues. If the overclock is built into the kernel or set before boot, you'll have to find another way.
Hi, i have Global Version with newest software. I have a issue with my phone. When I hold power button i don't receive options with power off, reboot ect. Only works on/off screen with click button. And now my question: did any of you have the same? For me it looks like software problem, because when I install application from Google Play something like Reboot everything's work. But it's anoying when all life you hold button and you have that option in android... In all phone there is no option to power off, restart device. Maybe someone have an idea? Thanks
Hold power + volume up for 3 seconds and power menu will appear
I have the Chinese version and the power button lint press launches an assistant feature. But if I press it longer, it loads the power options. Try pressing it longer hopefully it resolves the issue
RedFoXite said:
Hold power + volume up for 3 seconds and power menu will appear
Click to expand...
Click to collapse
YES it is working. Thank you very much !!!
Is it in all realne phones? It's different for me because all life i use Power Button in all phones. And another question. Is there option to change it for Power Button? Any app for this or something. Thank guys for reply
BOLEK_PL said:
YES it is working. Thank you very much !!!
Is it in all realne phones? It's different for me because all life i use Power Button in all phones. And another question. Is there option to change it for Power Button? Any app for this or something. Thank guys for reply
Click to expand...
Click to collapse
I don't know if this is in all Realme phones, this is my first device
I didn't find an option to change this
Chyba trzeba się przyzwyczaić
does realme chinese have the same hardware as global? I'm looking to buy the Chinese version, hoping to upgrade to the global version, do the apps notify normally? instagram whatsapp etc
settings-Breeno-Voice-turn off "Press and hold Power buttton..."
alex9yust said:
settings-Breeno-Voice-turn off "Press and hold Power buttton..."
Click to expand...
Click to collapse
Breeno is only available in the Chinese version
Hi i have the global version and i have the same problem holding the power button just brings up google assistant if i hold it longer plus volume up key nothing happens just the volume goes up hope this gets fixed in future updates
and being a new model i am finding it very buggy
driv5r1 said:
Hi i have the global version and i have the same problem holding the power button just brings up google assistant if i hold it longer plus volume up key nothing happens just the volume goes up hope this gets fixed in future updates
Click to expand...
Click to collapse
You need to push all buttons (power and vol +) in the same time and power menu is working, ofc it's better to hold power button instead but it's better than nothing
Thanks tried again and it works still the software still feels a bit buggy but we should expect that with a new phone software updates should clear that.
driv5r1 said:
Thanks tried again and it works still the software still feels a bit buggy but we should expect that with a new phone software updates should clear that.
Click to expand...
Click to collapse
For me it's not so bad at this state. Sometimes i have a glitch with screen freeze when I go to settings, or something like that. Previously i have a Mi 9 and it was for 3 years (now much software problems, Xiaomi: to much phones, to much software) but this phone is a rocket. Little software upgrades and it will be very good.
RedFoXite said:
Hold power + volume up for 3 seconds and power menu will appear
Click to expand...
Click to collapse
thanks this worked for me on global
yes, same goes with me. tried combined key then accidentally found how to turn off this device. really annoying.
also after update to newer version, AOD not working anymore. and I dont know if finger print reader not always standby? before I am using Mi note 10 pro, and this phone can unlock it without need to wake up the device.
have bug also in 3D photos, the image not separated at all, so the result only photos with wobble movement. Hopes realme fix it soon.
azrielnation said:
yes, same goes with me. tried combined key then accidentally found how to turn off this device. really annoying.
also after update to newer version, AOD not working anymore. and I dont know if finger print reader not always standby? before I am using Mi note 10 pro, and this phone can unlock it without need to wake up the device.
have bug also in 3D photos, the image not separated at all, so the result only photos with wobble movement. Hopes realme fix it soon.
Click to expand...
Click to collapse
Yeah, I also had this problems. The only way I found to solve it was to factory reset the device and do a clean install WITHOUT Cloud backup from Google (if I restore from Google, AOD, fingerprint icon, etc.. not working)
samueledenicola said:
Yeah, I also had this problems. The only way I found to solve it was to factory reset the device and do a clean install WITHOUT Cloud backup from Google (if I restore from Google, AOD, fingerprint icon, etc.. not working)
Click to expand...
Click to collapse
I found another bug. Hidden apps have a bug. It always unlock when I unlock the phone. It should be using secret code to activate the hidden folder, but now each time I unlock the phone using finger print, it automatically popup the hidden apps folder in unlock state.
Rather than hidden the apps, now apps that I want to hide became always appear right after unlock the phone screen.
Settings > Additional Settings > Power Button > Press and hold power button > Power Menu