Last Updated on August 8, 2017
I find it very annoying that even opening the viewfinder of the Camera pauses the Music in Android. Up until Android KitKat and below, things have been this way. But, now with Android 5.0 and above, we have a full-fledged permission system in Android which you can use to configure which app can do what on your phone.
You can toggle what an app on your phone can access. You can individually configure each app on your phone like access to Contacts, SMS, and Camera. There are hundreds of them.
You can normally configure most of the permissions by going to the Settings > Apps > APP_NAME > Permissions. But, the Android system doesn’t give you the full access to ALL the available permission toggles from the system UI.
One of the hundreds of these permissions is called as
TAKE_AUDIO_FOCUS which allows an app to control and take control of the audio on your device. By default, all apps have this permission upon installation.
But, because of this, some apps can simply play and pause your music and other audio streams whenever they want. One culprit for this is the Android Camera app. On some Android phones, you’ll see that as soon as you open the Camera app, the music stops playing. I’m not talking about the video recording, but while taking stills.
You can fix this issue by taking the
TAKE_AUDIO_FOCUS permission away from the Camera app on your phone. Now, depending on the manufacturer of your phone, the camera app name might be different. Please explore your apps section a bit before diving into the process.
Stop Camera App from Stopping Music
- Download and install the OEM USB Drivers for your phone. [SAMSUNG] [Xiaomi] [Sony] [HTC] [OTHERS].
- Download Minimal ADB for Windows (930.3KB). After downloading the file, open (minimal_adb_fastboot_1.4.1_portable.zip) it and extract it to the Desktop. Create a new folder on your Desktop with the name
portable_adband place the archive files in it.
- Connect your Android phone to your PC via a USB cable. Go to Settings > About Phone > Tap on the Build Number 7 times. This will unlock the Developer options on your phone.
- Now, Go to the Developer mode from Settings.
- Enable USB Debugging.
- Open the
portable_sdkfolder and right-click while holding Shift in anywhere empty space. Select Open Command Window Here.
- Type adb devices to list all the connected Android devices on your PC.
- You’ll get a Dialogue box on your phone asking you to give the permission to allow USB Debugging. Click OK to allow it. Also, check the Always allow from this computer checkmark so that you won’t need to do this everytime you connect your phone to the PC.
- Once you get a similar message in the cmd window, type
adb shellin the command prompt. This will open the command interpreter for Android which you can use to set the permissions which are invisible from the UI.
- To set the permission, you can use the following format for your device.
appops set <app.package.name> TAKE_AUDIO_FOCUS ignore
- I have a Moto G5 Plus and the inbuilt camera app on this phone has the package name
com.motorola.cameraone. On my phone, the command to stop the camera app from pausing the music will look like this:
appops set com.motorola.cameraone TAKE_AUDIO_FOCUS ignore
That’s it. Now, the Camera app will not get the permission to
TAKE_AUDIO_FOCUS on your Android phone. With this, your music won’t stop while you are using the Camera app.