Extension to detect power button

I want to create an app which can detect if power button is pressed few times then auto send message of the location.

Can someone help me on how to create an extension? Im new in mit app inventor and java.

Hello Wong

Your Topic needs to be in the Extensions Development Forum. Your goal however may not be achievable.

1 Like

can i know why cannot achievable? is there any problem?

1 Like

It may cause a runtime error that's why.

Is there anyway to solve it

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.

2 Likes

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

:question:

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 ...

2 Likes

Once is enough.

3 Likes

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