In android M, we can take a picture from default camera application when presses the Key volume down/up on the phone. By the observation, I want to take a picture by sending the key volume down/up action using code. This is my code but it is nothing happen when I ran it. How can I modify the bellow code such that it can take a picture?
Intent downIntent = new Intent(Intent.ACTION_MEDIA_BUTTON, null);
KeyEvent downEvent = new KeyEvent(eventtime, eventtime, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_CAMERA, 0);
downIntent.putExtra(Intent.EXTRA_KEY_EVENT, downEvent);
sendOrderedBroadcast(downIntent, null);