Most camera apps have an option to take a photo when volume buttons are pressed. I am trying to implement a background service that will send Volume Down keypress when the camera app is open. Here is what I tried so far for testing.
So any idea why the Volume button click emulation is not working in camera app?
- Create a service that has a SendInput object running inside a timer every 3 seconds
- SendInput.SendKeyCode(KeyCodes.KEYCODE_VOLUME_DOWN) is called inside the timer
- Before opening camera app, I can see this timer working as the device volume is decreasing. I also have a log message inside timer that confirms the same
- When Camera app is opened, I can see the log message indicating timer is executed but nothing is happening
- If I press the Volume button, the camera app takes a photo
So any idea why the Volume button click emulation is not working in camera app?