Stop Camera from Pausing Music in Android Lollipop and Above

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.

stop-camera-pausing-music-android-lollipop-above

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_sdk folder 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.

adb_devices_android

  • Once you get a similar message in the cmd window, type adb shell in 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

You can find the package name using any Package info apps from the Play Store. The one I used is called App Inspector.

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.

Photo of author

Written by Utkarsh

Utkarsh Bhatt is a certified tech expert and software engineer for a Fortune 500 Company. He was born in 1995, making him one of the oldest members of the team at EFX. Utkarsh loves solving technical issues and is always the first to jump on any problem that needs solving. When he’s not coding or debugging, he enjoys playing video games (especially Super Smash Bros.) and watching cartoons.

Share on:

15 thoughts on “Stop Camera from Pausing Music in Android Lollipop and Above”

  1. Dude, THANK YOU SO MUCH!!
    You don’t have idea how much I searched for an alternative to solve this problem of android.

    You’re the one!
    I really appreciate!

    Reply
  2. Did not work for my Xiaomi redmi note 5 pro default camera (com.android.camera), it does pause the music when I press video recording button.

    Reply
      • I searched and could not find a definitive answer to the differences between the two so I assumed that they would function identically, but I could not get anywhere with the “adb devices” so I thought that perhaps it was vital to use Command Window and not the Powershell.

        Reply
        • I’m a bit late to answering this – but it might be helpful to other people facing the same issue. If you open an admin CMD window by typing “CMD” in to the windows search bar, then right click on “Command Prompt” and select “Run as administrator”. It might prompt you for permissions, if it does click “yes” then a blank Command prompt window will open. From here you need to navigate to/select the portable_adb file, which you can do by typing “cd ” For me, the command looks like “cd C:UsersphiliDesktopportable_adb”. Then from there you can keep following the tutorial.

          If you’re having trouble figuring out the path of the portable_adb file, just open it in file explorer, then at the top of the file explorer window, just to the right of the forwards and back arrows, there’s a bar that’ll have something like “portable_adb” in it, click on/in that bar and the text should change to its file path which you can then copy and paste (or type out if you’d rather) into the CMD window.

          Hope that all makes sense, and is of some help to someone!

          Reply
      • Thanks, I figured that out. Step one is a bit short on info.
        After I downloaded the drivers and used the device manager to check, I was told that the drivers were up to date, so I feel more explanation of step one would have been useful.

        Reply
  3. Does this require a reboot, because it seems that it doesn’t work (‘appops get’ for com.motorola.camera2 TAKE_AUDIO_FOCUS returns ‘ignore’ though)?

    Thanks, Duncol

    Reply
  4. Thank you! That and the advice that someone else gave to turn off the sound in the camera app both helped. (Sony which is com.sonyericsson.android.camera if that’s useful to anyone)

    Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.