I’m a newbie to android and i’m trying to make an app that respond to a hardware input like camera button, handsfree call answer button,etc.
For example take camera button. When it is pressed the default camera app is launched. What I want to do is prevent that default response and make my app respond to that. I know it is possible to replace the camera app but thats not what i expect.
When the button is pressed, my app should run first and my app will direct to the camera app once my app is done. If this is possible please point me in the right direction
At the present time,
ACTION_CAMERA_BUTTONis an ordered broadcast. You can create an<intent-filter>with a higher priority to try to get control before the firmware’s own camera app, do what you want to do, and callabortBroadcast()to prevent lower-priority filters from receiving this broadcast.However:
You have no way to know at compile time what the priority is of the camera app in the firmware, or any other camera apps that the user may have installed.
ACTION_CAMERA_BUTTONis not documented as being an ordered broadcast. Hence, older versions of Android might not have it be ordered, future versions of Android might not have it be ordered, and device manufacturers do not necessarily have to keep it ordered.Very few devices have a CAMERA button