In ionic can we code funcationalities to power button in android?


i want to know that in ionic can we change the behavior of the hardware buttons especially power button , iam making an app for emergency situations in which when power button pressed thrice current gps location is stored as well as mic starts recording ? so i was wondering if this type of functionality is possible or not ?


Hi @aditbharadwaj,

I don’t think apps in general have access to remap these buttons, even native apps. So I’d say no, it’s not possible from an app. Unless you create a new system launcher/UI for Android or something like that. On iOS I’m 99.99% sure it won’t be possible without a hack or jailbreaking the device (which you shouldn’t do anyway).



if not remap maybe trigger some events like getting current gps or mic starts recording ? when power button pressed thrice ?
is that possible ?



Even if you could get a “power button pressed” event, if the user presses the power button the screen will turn off and your app will be paused, unless you use a native background service.

Honestly, there’s no point in me speculating about this, I have no idea :man_shrugging:t2:

1 Like