The ecosystem of different operating systems work uniquely, except for the base procedures that run exactly everywhere. Whether you’re using an Android smartphone, iOS smartphone, Windows smartphone, or a Windows Laptop, there are APIs or Application Programming Interfaces that play an important role in completing all the tasks.
These APIs are responsible for everything you do on the operating system, likewise the Camera API for the camera hardware.
Talking about the wholesome versions from initial to this date, Google introduced two versions of Camera API, Camera1 API, which has the general access to Camera and Videography.
The second and last version we have until today is Camera2 API, and this sole version is responsible for all the futuristic camera options and modes. Downside in this article, we’re going to learn the process of enabling Camera2 API on the smartphones where it’s disabled.
It’ll contain the different methods for API enabling in particular Android protocols, rooted and non-rooted smartphones. Whatever state of Android device you’re using presently, you should tend to use the exact working procedure.
Including that, we’re also listing a bonus procedure method which you can follow to get back to the default Camera API state if you had changed it using any of our given procedures.
Page Contents
What is Camera2 API?
We discussed all the unique APIs, and now there is one that connects the software with the Camera hardware in your Android smartphone, and developers have named it Camera API.
Google has worked strongly on the Camera APIs, and majorly the latest generation, i.e., Camera2 API to provide the Android users with external control on their phone’s camera hardware. From capturing a simplistic photography to making a portrait blurred masterpiece.
You must be thinking why Google developed the Camera2 API after we had Camera1 API already there for capturing pictures and recording videos. In actual, pushing the limits was what they actually wanted in an advanced version of the Camera API.
All the camera features you are exploring these days, including the modes to record slow motion videos, time-lapse videos, adjusting ISO, shutter speed, or exposure; all these things are the gifts of the Camera2 API.
Difference Between Camera1 API and Camera2 API
We acknowledged the Camera API as well as the latest version, i.e., Camera2 API in depth, and all we need to know as of now is a difference between both the available API versions. Although, you know that the newer version would have way more features than the first one, but knowing a difference would open doors to a detailed technology comprehension:
Compatible Android Versions
When we elaborate on the base or initial version Camera1 API, it can work with any Android smartphone developed yet, from the first HTC Dream, the first commercially available smartphone to the latest Google Pixel 8 Series. But Camera2 API has some compatibility problems with all the Android devices working below Android 5.0 version. We know that most of today’s devices are already above that, and so you won’t need to be concerned.
Camera Modes
The stock camera apps on the Android phones with Android 5.0 and below versions only had a few camera modes, including Camera and Video. Later, we got some simplicity rich modes like Portrait, Night Sight, Astrophotography, Panorama, and Time Lapse videography. All the later modes can only work if your phone has got the Camera2 API access, and all the Camera1 API phones can either capture a picture or record a video at all.
Third-Party Camera Apps
Talking about the older generation before February 2014, when there was just the Android Kitkat or 4.0 version, no developers were working on intensifying the camera hardware. The apps we see nowadays on Google Play Store, like Retrica, PicsArt, FaceApp, Google Camera, ProShot, etc. only works through the presence of Camera2 API. Otherwise, they won’t work at all.
Camera Features
Not everyone is using the HDR+ Enhanced camera modes on their phones these days, and that’s what makes us understand that people still need to see the most pushed limit of their smartphone’s camera. There are many such features like RAW JPEG photography, HSL adjustments, AR Stickers, and Night Sight which can only be used with the Camera2 API. Camera1 API only had options for shutter sound, camera timer, and grids.
Camera Frame Rates
These days, everyone purchases a smartphone after looking at the camera specifications, mostly the frame rates compatible with the camera hardware. Back when it was the Camera1 API era, we only had up to 10 FPS cameras, and in this newer generation of Camera2 API, we can capture videos with up to 1000 FPS camera phones like Motorola Edge 30 Ultra.
How to Enable Camera2 API Support on Rooted Android Phones?
Talking separately about the Android operating system, it’s a Linux subsidiary, and that’s why it offers you the freedom to make any changes in the backend if you like.
Well, these things can’t be done ordinarily and that’s where we come to the conclusion of having the usage of different tools like ADB commands, Terminal apps and flashing multiple modules.
Prerequisites
In case you’re thinking of enabling the Camera2 API support on your device after checking it disabled already from these checks, you can follow any method among the below list.
But remember, these prerequisites are important to be followed before proceeding with any method, and it’ll only work if you’re using a rooted Android device:
- Firstly, only rooted android phones need to be rooted before using any method below.
- Get to the Settings app on your phone, open the About Device tab, click Build Number 5 times, and enable Developer Options. Then enable USB Debugging in the Developer Settings.
- If you don’t have the ADB Drivers installed on your PC, click this link, download, and install the ADB Drivers first.
- There are four methods below, and if you’re going to use the TWRP Recovery method, you would have to get the latest version of TWRP Custom Recovery on your device. Any older version can show conflicts with enabling Camera2 API.
Method 1: Using Terminal Emulator app
Terminal Emulator is an android application that works as Termux and takes your codes to make any changes in the backend APIs of a smartphone.
It comes already installed on most rooted smartphones, and even if it’s not there, you can download it through the link below and install it on your device.
After installing it on your device, follow the below few steps to enable Camera2 API access:
- Once you have installed the Terminal Emulator app, launch it.
- On the coding interface, grant root access through entering this command –
su
- Once the root access is activated, enter and run the below command –
Setprop persist.camera.HAL3.enabled 1
- Running above command will ask for the last command; enter this one –
Setprop vendor.persist.camera.HAL3.enabled 1
Run the command and restart your device to get the Camera2 API finally enabled on your Android phone. If you are finding any errors in this method, try the next one, and it’d definitely work for you.
Method 2: Using X-Plore File Manager
Enabling Camera2 API on rooted smartphones can also be done with a privileged File Manager application that makes most of the root files accessible and editable.
One of the most prominent options is the X-Plore File Manager app. You can download this app if it’s not present on your smartphone from this link:
This app offers a diverse range of features, where there are the editing options for prop script files, once you find them, it’s easy to enable Camera2 API. Moreover, you can follow the below steps to make it simpler:
- Open X-Plore File Manager app once you install it.
- Among numerous shown folders, open System.
- Under the System folder, find Build.prop script file and click to edit it.
- All the required editing is just to add this additional command among what’s already there
Persist.camera.HAL3.enabled = 1
- Click the Save button above and restart your rooted phone.
Once you would have completed this procedure, after a reboot, you’d get the Camera2 API enabled on your phone, which makes you capable of using any camera app with pushed limits, including Google Camera.
Method 3: With Magisk Module Library
Magisk users mostly sound like privileged root access users and that’s because of the Magisk modules which can be used for various backend tasks.
Similarly, there is a module that you can download from the below link and follow a procedure to flash it through the Module library and enable Camera2 API:
- Remember that first you need to download the API zip file from the above link.
- Launch Magisk Module Installer function on your rooted device.
- Go for installing a custom module and choose the zip file we have downloaded.
- Wait for the installation to get completed and then reboot your smartphone.
The Magisk rooted smartphone users call themselves privileged ones and that’s just because of the hyper simplicity. Just three steps and you got what you wanted the most.
Method 4: Flashing API with TWRP Recovery
This procedure requires you to have the TWRP installed on your phone; otherwise it won’t work. It’s just because the requirement here is to flash a zip file of the Camera2 API, and so you can understand that a rooted or unrooted phone with TWRP can perform it straightly.
Once you got the TWRP, download the zip file below and get started with the below steps:
- After downloading the ZIP file, reboot your phone in TWRP Recovery mode. (Remember where you downloaded the file.)
- Navigate TWRP to the location where you downloaded the installable zip file.
- Click on the file and hit the Flash button.
- Once the flashing is done, reboot your device to general Android UI.
- After this reboot, you’ll get the API flashed and enabled on your phone.
All the above methods are legit and can work on any Android smartphone which contains root access through Magisk or any other protocol.
If you finally have enabled the Camera2 API, it means that you can go ahead and install the Google Camera app to have the better camera.
How to Enable Camera2 API support on Unrooted Android Phones?
The procedure to enable Camera2 API support on unrooted smartphones would not be as easy as you did on rooted ones.
It’s just because rooted phones can access most of the backend procedures, APIs, accesses, and most of the changes you want to make, unlike the lack of freedom you get on the unrooted devices.
However, rooting an android phone also causes a bit of concern in smartphones, and that’s why we don’t recommend doing so.
You just need to be following a larger number of steps, and your phone’s data, hardware, and processor would be exceptionally safe as we won’t be getting the root access. It’d start with firstly following a few prerequisite steps as listed down below:
- We don’t need a rooted phone, but at least the bootloader needs to be unlocked to follow the below procedure.
There are some disadvantages of unlocking the bootloader too, and it’d be good if you’ll research it completely before taking that step. If you’re good to go, unlock it through these steps. - Under the Developer options, enable the USB Debugging mode. (If you can’t find Developer Options, get to the Settings app on your phone, open the About Device tab, click Build Number 5 times, and enable Developer Options first.)
- You also require a PC, as we’re going to follow a few ADB commands to gain Camera2 API access.
- Download the latest TWRP img file to your PC.
- Some important ADB Drivers are required to be installed on your PC before going ahead. Click this link and get the .exe file to install before initializing the procedure.
- Within the ADB Driver, you’ll also need a minimal_adb_fastboot.zip file within the process. Download it too from here.
Once you have completed the above steps on your Android phone, you’re ready to follow the final procedure of enabling Camera2 API, and it goes as this first step below:
Step 1: Preparing PC and Smartphone
The first part of the procedure requires you to prepare your PC and Smartphone, and it goes with a few essential installations as well as the TWRP flashing.
After this, we’ll be ready to boot the IMG file on the smartphone using the PC’s command prompt.
So foremost, follow the below steps subsequently:
- Once you have installed the ADB Drivers on your PC, unzip the minimal_adb_fastboot.zip file to a particular location.
- Rename the TWRP file downloaded from prerequisites to
recovery.img
. - Once you have renamed it, move the recovery.img file to the same folder where you unzipped the last zip file; minimal_adb_fastboot.zip.
- Use a compatible USB cable and connect your phone to the PC.
Step 2: Booting img file with Command Prompt or CMD
Once you have made the installations and prepared your PC with the smartphone, all you need now is to boot the img file we have downloaded in the first step.
It can easily be booted through the Command prompt on a PC using the ADB Drivers we installed in the prerequisites. Now, you need to follow the below steps and put in the required commands:
- Open the folder where we unzipped the minimal fastboot file and copied the renamed file.
- Among numerous files, double-click the cmd-here.exe file.
- Once you’ll see a Command Prompt screen opened on the screen, paste this command on there:
adb devices
- Press the Enter button and if you’re getting the Positive result, type down this command:
adb reboot bootloader
- Hit the Enter button once again, and finally type this command on the cmd screen:
fastboot boot recovery.img
Last time, press an Enter button and half of the process can be seen done as it’ll automatically open the TWRP Mode on your device.
Step 3: Enabling TWRP Modifications
After booting the IMG file, you’d start seeing the TWRP custom recovery screen on your device. Now, you came almost half the road to enable Camera2 API and on TWRP interface, you need to follow these few steps:
- Once the TWRP Custom Recovery mode is launched on your device’s screen, scroll down.
- Search for the toggle Swipe to Allow Modifications and enable it.
Step 4: Enabling the final API
This is the final step as we have allowed for the modifications in the Camera2 API, and now it’s time to do what we want and push the limits of our phone’s camera hardware.
The lastly required steps would require you to keep your phone connected with PC, and follow the below few commands pasting:
- Paste these commands again on the cmd, keeping the phone still connected:
adb devices - Click the Enter button and paste this next command on the screen:
adb shell - Hit the Enter button and enter these commands to enable Camera2 API:
setprop persist. camera.HAL3.enable 1 - Press the Enter button, and now you have to exit ADB Bootloader; type the below command:
exit - The Enter button would automatically make you exit the ADB Shell. Hit this last command, that’ll reboot your phone with enabled Camera2 API:
adb reboot
Press the Enter button one last time.
It’s true that the commands we pasted on the Command Prompt and the steps we followed above to enable Camera2 API were a little complex.
But if you would rather not root your Android device and simultaneously make the things work properly, the only method for enabling the API goes through the above steps.
After following them all, you’d get freed to download and use any third-party camera app on your device or even use the GCam Port without any concerns.
How to Restore Back to the Default Camera API on Android?
We have completed enabling the Camera2 API until the above last Step 4. Now, it can be possible that you’ll need to get back to the default Camera API.
Which can happen because of any circumstances, like problems with the Camera hardware, stock app being crashed, or just you want to switch back in general. That can also be done with a few replica procedures with the Step 4 of the above procedure.
In case if you would like to get back to the default Camera API on your Android phone, just process the Step 4 from the above procedure and make the below changes in TWRP Recovery:
- The same Step 4 from the above section and on the third point, make these modifications:
In place ofsetprop persist. camera.HAL3.enable 1
Type thissetprop persist. camera.HAL3.enable 0
- Click the Enter button and again for exiting the ADB shell, follow the below command:
exit
- Click the Enter button and type this last command to reboot your phone:
adb reboot
- Hit the Enter button for a final time.
Once you have completed the above three steps, you’ll see your phone being rebooted automatically.
Later, you can check the Camera API access through a probe Camera API app available on the Google Play Store, and you’d see your phone back to the default condition.
Thanks for reading and performing the procedure, and now you have successfully made the changes.
Wrapping Up
Camera2 API is important to be installed once you want to make your phone’s camera push all its limits. Get beyond those limitations of having the minimal number of camera modes and refuse access to most of the creative camera features like HDR+ and Night Sight.
All you need is to enable the Camera2 API access on your phone, and you may already have done it from the above procedures.
Remember, you can bookmark this article for future usage, in case you’ll have to switch back to the default Camera API from what you modified it to.
Either remember us, which is too hard in this online generation as we go through immense websites every day, or click the above bookmark button and save the page for the future.