Can the power button be disabled while using an app? - android

I am making an alarm app for Android. Is there a way to disable the volume control and the phone's power button from within the app? If the app needs to ask the user for permission before doing this, thats fine.

Related

how to disable notification sound programmatically from another app

I was wondering if it was possible to mute notification sounds programmatically?
what I wanted to achieve with this is that a user can select which apps he wants to mute from a single app instead of entering into the settings menu
it is not possible by design.
Android idea for app is to run app in sandbox and do not allow it affect any other applications.

How to use volume keys to open a activity when device is locked?

Hi all i want make app which run over volume key for example when we press the volume down key it turn camera open( when device is locked) similarly i want the same in my app.
I don't think that's possible
Those functionalities come from the factory OS you have, not from specific apps. The only way that could be possible is by rooting the device, in which case you may be able to listen to physical button clicks and modify their behaviour.
This page shows an application that can alter the buttons behaviour once the device is rooted, but again, this won't teach you how to do it, as again, it's not for the majority of the users and you'd need to root every device.

Android Soft Button and Hardware Button

I want to create an app that is not usable by the user but performs some functionality outside the app, the app just run in the foreground and listen to the press of android hardware/software buttons, the likes of Power button, home button, volume up and down. It triggers a call when for instance, the volume up button is pressed down for 5 secs and notification appears.
I have checked solutions like this
Intercepting the back button
How to override the behavior of the volume buttons in an Android application?
But this solutions have something to do with the user accessing the app directly, i mean to perform this functionalities you have to be on the app which i don't want.
The app was suppose to be run on a smart watch which runs android OS. I was thinking if i can perform this on android phone, it should be easier on the smart watch.
Note:
The App is for targeted users, who will be trained to understand that behavior.

How can I delay the bluetooth permission bluetooth on android app?

Im creating an android app, and it beggins with a zoom out transition. And it has a popup that ask the user to allow or not the use of bluetooth. The thing is i want to have a delay on that popup so the user can see the transition.

How to prevent powering off an android device by Power button?

I'm developing a security program that prevent moving phone without knowing its owner. When program is running when phone moves alarm will fire and show unlock screen to spot the alarm. The alarm can be stop by a password. But the problem is when use press and hold the power button, phone will shutdown. So is there any way to disable power button action?
So is there any way to disable power button action?
There is no way for an ordinary Android application to prevent the power button from functioning, for blindingly obvious security reasons.
It is conceivable that there are ways to accomplish this on rooted devices. Also, if you create your own custom ROM, you can integrate your alarm feature into it, blocking the power button operation while in the alarm state.
There is no way to work around this, because even if it was possible to prevent a shutdown, there would still be the option of simply removing the battery.

Categories

Resources