简体   繁体   中英

Check if the camera shutter sound is on or off in the settings Android

I'm using a custom camera application , i want the camera to enable the shutter sound if it was on on the device and turn it off otherwise , so is there a default method which will check that , or can i get the settings information of the camera to find that .

I tried this code , but it sounds that is check on the device sound.

    AudioManager audioService = (AudioManager) getSystemService(Context.AUDIO_SERVICE);

    if (audioService.getRingerMode() != AudioManager.RINGER_MODE_NORMAL) {
        Toast.makeText(MainActivity.this, "Normal", Toast.LENGTH_SHORT)
                .show();
    }
Camera.CameraInfo info = new Camera.CameraInfo();
Camera.getCameraInfo(id, info);
if (info.canDisableShutterSound) {
    mCamera.enableShutterSound(false)
}

How to mute camera shutter sound on android phone

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM