How to Enable Camera2 API?

How to Enable Camera2 API on Any Android Device?

If you want to install the Google Camera port on your Android device, enabling the Camera2 API is essential. This API upgrade can significantly enhance your camera’s performance, allowing you to capture stunning photos and videos effortlessly.

But what if your phone doesn’t support the Camera2 API by default? Don’t worry, we’ve got you covered. This guide will walk you through various methods to enable the Camera2 API, ensuring your phone can take full advantage of advanced camera features.

Before we dive in, let’s clarify some key terms and prerequisites.

Understanding Camera2 API

Older Android devices come with basic camera APIs that may not deliver the best results. To address this, Google introduced the Camera2 API with Android 5.0 Lollipop. This API offers a range of features designed to improve camera performance, including better HDR+ capabilities and enhanced low-light photography.

For more details, you can visit the official page.

Prerequisites

Before you start, ensure you have the following:

  • Root access on your device
  • Developer settings enabled with USB debugging
  • Necessary ADB drivers installed on your PC or laptop
  • The correct version of TWRP custom recovery for your phone

Note: While there are various ways to root your phone, we recommend using Magisk for a stable setup.

Methods to Enable Camera2 API

Some smartphones, like those from Realme running Android 11 or higher, have Camera HAL3 settings that allow the use of third-party camera apps. For other devices, follow these methods:

Method 1: Using Terminal Emulator App (Root Required)

  1. Open the Terminal Emulator app.
  2. Grant root access by typing su and pressing Enter.
  3. Enter the command setprop persist.camera.HAL3.enabled 1 and press Enter.
  4. Enter the command setprop vendor.persist.camera.HAL3.enabled 1 and press Enter.
  5. Reboot your phone.

Method 2: Using X-plore File Manager (Root Required)

  1. Install the X-plore File Manager app.
  2. Navigate to the system/build.prop file.
  3. Edit the file and add persist.camera.HAL3.enabled=1 at the bottom.
  4. Reboot your phone.

Method 3: Via Magisk Modules Library (Root Required)

  1. Download the Module-Camera2API-Enabler.zip from the Magisk module library.
  2. Install the ZIP file using the Magisk Manager.
  3. Restart your device to enable the Camera2 API module.

Method 4: Flashing ZIP File through TWRP (Root or No Root)

  1. Download the necessary Camera2API ZIP file.
  2. Boot your phone into TWRP custom recovery.
  3. Locate and flash the ZIP file.
  4. Reboot your device.

Enabling Camera2 API Without Root Access

Though rare, it is possible to enable Camera2 API without root access. Here’s how:

Requirements

Step-by-Step Guide

Step 1: Setup

  1. Install the ADB drivers on your PC.
  2. Extract the minimal_adb_fastboot.zip.
  3. Rename the TWRP file to recovery.img and move it to the minimal fastboot folder.
  4. Connect your phone to your PC using the USB cable.

Step 2: Command Prompt

  1. Open the cmd-here.exe in the minimal fastboot folder.
  2. Enter adb devices to check the connection.
  3. Enter adb reboot bootloader to access boot mode.
  4. Enter fastboot boot recovery.img to open TWRP mode.

Step 3: TWRP Mode

  1. Once in TWRP, swipe to allow modifications.
  2. On your PC, enter adb devices again to ensure the device is connected.
  3. Enter adb shell.
  4. To enable Camera2 API, enter setprop persist.camera.HAL3.enable 1.
  5. Exit the shell with exit.
  6. Reboot your device with adb reboot.

Restoring Camera2 API to Default

To revert the Camera2 API changes, follow the steps above but use setprop persist.camera.HAL3.enable 0 in place of setprop persist.camera.HAL3.enable 1.

Conclusion

Enabling the Camera2 API can significantly enhance your Android device’s camera performance. While the process often requires root access and TWRP, it’s a manageable task that brings noticeable improvements. Once completed, you’ll be ready to install the Google Camera app and enjoy superior photo quality.

If you have any questions or need further assistance, feel free to leave a comment below!