How to enable Camera2 API support on an Android device.

Advertisement

If you want to install the Google Camera port on your Android device and enjoy all its benefits, enabling Camera2 API is necessary. Typically, these ports enhance the camera quality and allow you to capture stunning photos and videos effortlessly.

However, when you check the camera API feature on your phone, you may find that your device does not support these APIs. In such cases, the last option is to gain access to this application programming interface by flashing a custom recovery or rooting your Android phone.

In this post, we will explore various methods through which you can easily enable Camera2 API support on your phone.

Older Android devices usually come with a camera API that may not be very good. However, Google introduced the Camera2 API in Android 5.0 Lollipop. It is an improved API that offers a wide range of features to enhance the overall camera quality on phones.

Advertisement
Continue Reading

These features provide better HDR+ results and enable low-light photography with advanced software processing.

For more information, it is recommended to refer to the official documentation.

Prerequisites

  • In many methods described below, gaining root access is required.
  • Enabling USB debugging is required by accessing developer settings.
  • Installation of appropriate ADB drivers on your PC or laptop is needed.
  • Obtaining the correct TWRP version for your phone is necessary.

Note: There are multiple ways to gain root access on your phone, but we recommend using Magisk.

Methods to Enable Camera2 API

Some smartphone manufacturers, such as Realme, provide a Camera HAL3 feature in additional settings that enables the use of third-party camera apps. However, this applies only to Realme phones running on Android 11 or above. For other smartphones, you can use the following methods:

1. Using the Terminal Emulator app (Root)

  • Open the Terminal Emulator app.
  • Type “su” to gain root access and press Enter.
  • Enter the first command “setprop persist.camera.HAL3.enabled 1” and press Enter.
  • Enter the second command “setprop vendor.persist.camera.HAL3.enabled 1” and press Enter.
  • Reboot your phone.

2. Using the X-plore app (Root)

Advertisement
Continue Reading
  • Download and install the X-plore File Manager to access the system folder.
  • Open the system/build.prop folder.
  • Find the Build.prop file and edit it by adding the line “persist.camera.HAL3.enabled=1” at the bottom.
  • Reboot your smartphone.

3. Using Magisk modules (Root)

  • Download the Module-Camera2API-Enabler.zip archive from the Magisk module repository.
  • Install this archive in the Magisk manager.
  • Reboot your device to activate the Camera API module.

4. Flashing a zip file through TWRP (with or without root access)

  • Download the required Camera2API zip file.
  • Boot your device into the TWRP custom recovery.
  • Locate and select the Camera2API.zip file.
  • Flash the Camera2API.zip file onto your device.
  • Reboot your device to apply the changes.

Can Camera2 API Features Be Enabled Without Root Access?

Unlocking Camera2 API typically requires gaining root access as these files are often accessible only with full root access to the device.

However, if you want to access API features without root access and are willing to spend some time, we recommend following the guide below.

Accessing Camera2 API Without Root Access

Here, you will learn the complete process of obtaining camera API files without modifying system files. Let’s start with the basic requirements for this procedure:

  • Ensure that the bootloader of your Android device is unlocked.
  • Enable USB debugging in the developer settings.
  • A Windows 7, 8, 10, or 11 PC or laptop is recommended.
  • Connect your phone to the computer using a USB cable.
  • Download the TWRP file for your smartphone.
  • Download the ADB Driver.zip and minimal_adb_fastboot.zip.

Step 1: Perform the Full Setup

  • Install the ADB Driver.zip on your computer.
  • Extract the minimal_adb_fastboot.zip archive.
  • Rename the downloaded TWRP file to recovery.img and move it to the minimal fastboot zip folder.
  • Use a USB cable to connect your phone to the computer.

Step 2: Launch the Command Prompt

  • Double-click on cmd-here.exe in the minimal zip folder.
  • Type the command “adb devices” and press Enter to check if the device is connected.
  • Type the command “adb reboot bootloader” and press Enter to enter the bootloader mode.
  • Type the command “fastboot boot recovery.img” and press Enter to start TWRP mode.

Step 3: Use TWRP for Modifications

  • After entering these commands, wait for a while.</li >
  • You will see the TWRP custom recovery mode activated on your phone’s screen.
  • Perform a swipe to allow modifications.
  • Switch back to the computer/laptop screen.

Step 4: Enter Secondary Commands

  • Type the command “adb devices” and press Enter to check if the device is connected.
  • Type the command “adb shell” and press Enter.
  • To activate Camera2 API, enter the command “setprop persist.camera.HAL3.enable 1” and press Enter.
  • Type the command “exit” and press Enter to exit the ADB shell section.
  • Type the command “adb reboot” and press Enter to perform a normal reboot of the device.

How to Restore Camera2 API to Its Original State?

To revert Camera2 API to its original state, repeat the entire process from Step 4 as if you were installing the Camera API in the previous section.

  • You simply need to replace the command “setprop persist.camera.HAL3.enable 1” with “setprop persist.camera.HAL3.enable 0” to disable the Camera API override.
  • Type the command “exit” and press Enter.
  • Finally, enter the command “adb reboot” for a normal reboot of the phone.

Note: If you don’t install TWRP, you won’t have any issues with receiving updates. Additionally, Camera2 API will revert to its original state after installing OTA updates. You can also perform a check using the Manual Camera Compatibility app to confirm the changes.

Conclusion

The best way to access Camera2 API is to gain root access and set up TWRP. Once the process is complete, you can easily install the GCam app on your Android device without any hassle.

Advertisement
Apk world