Extension to detect power button

I have found a few links that might help. Thank you for this idea. I will start making (if possible) the extension.

1 Like

Hope you can share :pray: It is really important in my project

1 Like

Wait a minute...isn't this already asked in the community?

I found the same Stack Overflow link and I am figuring out how to make it.


i don't really saw any solution for this...

That was the solution. However, I looked in that code and that needed 3 Java files, and I have never tried piecing them into one file for an extension.

Do you have any specific reasons for using this? Why can't we just have a button that sends the message?

Im developing an app for my final project... So I need this as a way to speedy use the app

For extension developers, this might help.

how to connect this to mit app

That's just the Java code to the answer.

It would be complicated, especially if you are

because making extensions are for advanced developers. I will try to make the extension, but I cannot guarantee that this will succeed.

:pray: ThankYou. Hope u can make it


pressing the power button few times to activate the app

Whether the power button was pressed (not a long click) can be checked with my extension IdleMode.

After pressing the Power button once and coming back to the screen and after pressing it again ...


Once is enough.


It's an issue because Smartphones are not intended to have the power button applied multiple times in succession. You could cause memory corruption.

Detection of one button press should suffice.

1 Like

I think it is rather easier to have a button on the screen being pressed rather than the power button. It is meant to turn the screen on/off, not for extra widgets.

Ermm...I see. Thank you guys for the explanation and help. I will change to another function.

Is it possible to make a phone call when the screen is lock by shaking the phone?

This works with the Extension Template, but I would also like to know how to do this with e.g. the NiotronIDE. Maybe @vknow360 knows.

1 Like

You can add them to main class as inner classes.
For example, you can look at CustomWebview source.