How to Enable Camera2 API on Android Phones

Enabling the Camera2 API is crucial for accessing the Google Camera port on your smartphone. These ports significantly enhance camera quality, enabling the capture of stunning photos and videos effortlessly.

However, if you discover that your phone lacks support for these APIs upon checking its camera API functionality, you still have one option available: acquiring the application programming interface through custom recovery flashing or rooting your Android device.

In this article, we’ll explore various methods to enable the Camera2 API on your phone seamlessly. But before diving in, let’s familiarize ourselves with some key terms if you’re encountering them for the first time.

What is Camera2 API

In older Android devices, the camera API may not deliver optimal performance. However, Google introduced the Camera2 API with Android 5.0 Lollipop, offering enhanced capabilities to improve overall camera quality.

This updated program provides a plethora of features, including improved HDR+ results and advanced software assistance for capturing low-light photos effectively.

For more detailed information, we recommend referring to the official documentation.

Pre-Requirements

Before proceeding with any of the following methods, ensure that: Your device has root access. USB debugging is enabled in Developer Settings. ADB drivers are correctly installed on your PC or laptop. You have the appropriate version of TWRP custom recovery compatible with your device.

Note: While there are multiple methods to root your device, we suggest using Magisk for its stable configuration.

Methods for Enabling Camera2 API

Certain smartphone manufacturers, such as Realme, offer Camera HAL3 in additional settings, allowing for the use of third-party camera apps after enabling Developer Mode. This feature is available in Realme devices running Android 11 or later updates. However, this functionality may not be present in many other smartphones.

If your device lacks this feature, you can explore the following methods to enable Camera2 API.

Utilizing Terminal Emulator App (Root Access)

To begin, open the Terminal Emulator app on your device. Grant root access by entering the command:

bash
su

Then press Enter. Input the following command to enable the Camera2 API:

bash
setprop persist.camera.HAL3.enabled 1

Press Enter to execute the command. Proceed by entering the next command:

bash
setprop vendor.persist.camera.HAL3.enabled 1

Again, press Enter to execute the command. Lastly, reboot your phone for the changes to take effect.

  1. Employing X-plore Application (Root Access Required) Start by downloading and installing the X-plore File Manager. Launch the app and navigate to the system/root folder. Access the system/build.prop folder. Select Build.prop and edit the script. Add the line “persist.camera.HAL3.enabled = 1” at the end of the file. Save the changes and reboot your smartphone.
  2. Leveraging Magisk Modules Library (Root Access Needed) Download Module-Camera2API-Enabler.zip from the Magisk modules library. Install the downloaded zip file via the Magisk Manager app. Restart your device to activate the Camera2 API module.
  3. Flashing Zip File via TWRP (Root Access or Without Root) Download the appropriate Camera2API zip file. Boot your phone into TWRP custom recovery mode. Locate the downloaded zip file and select it. Flash the Camera2API.zip file onto your smartphone. Finally, reboot your device to complete the process and observe the results.

Is it possible to activate Camera2 API functions without Root Permission?

Unlocking the Camera2 API typically requires root access, as these files are usually accessible only with complete root permissions. However, if you’re willing to invest the time and effort, you can access the API functions without root using the following guide.

Accessing Camera2 API without Root:

In this guide, we’ll walk you through the process of obtaining Camera API files without altering system files. Let’s start by outlining the necessary prerequisites for the procedure.

Requirements:

Ensure your Android device’s bootloader is unlocked. Activate USB debugging through developer mode. A PC or laptop running Windows 7, 8, 10, or 11. A USB cable to connect the phone to the computer. Download the TWRP file specific to your smartphone. ADB Driver.zip and minimal_adb_fastboot.zip

Step-by-Step Procedure:

Step 1: Setting up

Install the ADB driver.zip on your computer. Extract the minimal_adb_fastboot.zip file. Rename the downloaded TWRP file to recovery.img and move it to the minimal fastboot zip folder. Connect the PC to the phone using the USB cable.

Step 2: Command Prompt

Double-click on cmd-here.exe in the minimal zip folder. Check if the device is connected by entering the command: adb devices Press Enter. Access the boot mode by typing: adb reboot bootloader Press Enter. Open the TWRP mode by typing: fastboot boot recovery.img Press Enter.

Step 3: Using TWRP Mode

Wait for a moment after entering the commands. Activate TWRP custom recovery mode on your phone screen. Swipe to allow modifications. Return to the computer/laptop screen.

Step 4: Executing Commands

Check device connectivity by typing:

  • adb devices Press Enter.
  • Enter the command: adb shell Press Enter.
  • To activate Camera2 API, use: setprop persist.camera.HAL3.
  • enable 1 Press Enter.
  • Exit ADB shell by typing: exit Press Enter.
  • Restart the device normally by typing: adb reboot Press Enter.

Restoring Camera2 API:

  • Repeat Step 4 to restore Camera2 API as before.
  • Replace: setprop persist.camera.HAL3.enable 1 with: setprop persist.camera.HAL3.
  • enable 0 to deactivate camera API overwrite.
  • Type: exit Press Enter. Type: adb reboot Press Enter.

Note: By not installing TWRP, you avoid update-related issues. Applying an OTA update will restore Camera2API to normal. Additionally, verify manual camera compatibility to confirm the changes.

Leave a Comment