fix sensors that are not working on HTC phone

If you are facing difficulties or having problem using any of the sensor on your HTC Android phone, including the accelerometer, proximity, gyroscope, and compass/magnetic field sensor, after flashing a new custom ROM or upgrading from one API level to another, then this tutorial is meant for you. Addicted flashers most time experience this issue after flashing custom ROMs on their Android device, I’ve once experienced the same too, but fortunately I was able to sort it out. This tutorial is meant for all HTC phones running any Android version and Sense version, including the latest.

Few years back I bought HTC One Max on eBay which comes installed with the official stock Android 4.3 Jelly Bean with Sense 5.5, after few weeks of use I decided to upgrade it to Android 5.0.2 Lollipop, which was rolled out 18 months after it was launched. Having unlocked its bootloader and gained superuser access, I decided to install one of the stable custom Lollipop ROMs I found on XDA. The flashing went smoothly and the ROM worked well.

But few days later I discovered that the phone built-in compass was not working. When using map, the pointer that normally show the direction the user is facing or heading to is not showing. I installed CPU-Z and checked the sensors tab, the magnetic field sensor was among the list of sensors but there was no readings. It simply showed “3-axis Magnetic field UNCALIBRATED sensor”. All other sensors are functioning except this sensor.

To be sure, I installed an app called Sensor Kinects to confirm functioning sensors on the phone, but the magnetic field sensor showed no readings as well. At that moment, I knew something was wrong. To cut the story short, I was able to fix this issue and that is what I’ll be teaching you today.

Installing several compass app with calibration feature was not able to fix the problem, I had to go to the root and fix it manually. This is a bit complex, but I will try to make this tutorial simple and easy to digest as much as I can.

The problem is not with the hardware because the compass was working properly when it was on stock Jelly Bean, the problem is with the ROM itself, or it could be that there was a conflict between the system files controlling this specific sensor. Compass relies on magnetic field sensor to work on any Android device.

The solution I will be providing, however, applies to all the malfunctioning sensors you may experienced on your HTC phone and not specifically to the magnetic field sensor. These includes accelerometer, proximity, gyroscope, G-sensor, and others as previously mentioned.

Lets begin

For the given steps below to work for you, your HTC bootloader must be unlocked and your phone must have root access.

It will be an added advantage if you fully know how to use ES File Explorer, which is our major tool in this case. If you don’t know how to use ES File Explorer, you can applied the Step 2 and Step 3 below using winrar on your PC, then move the extracted system files to your phone to complete the Step 4 and Step 5.

This tutorial is only meant for stock/custom Sense ROMs.

Before applying the following steps, please back up your phone.

Step 1

The first necessary step is to download the official stock ROM available for your device. Hope you remember that I only encountered ththe problem on a custom ROM. If I have been on the stock ROM made for the device I won’t have experienced the issue. Stock ROMs are mostly perfect than the one coded or ported by developers.

If the Android version of the ROM on which you are having the malfunctioning sensor is Android 7.0 Nougat, find the stock Android 7.0 Nougat ROM available for your phone and download it somewhere on your phone external storage. Do not install it. Make sure the Android version, API level and Sense version are the same, this is very important.

Note: If there is no stock Sense ROM of the exact Android version of the custom Sense ROM on your phone, or HTC does not release that specific Android version for your device, you can download another custom Sense ROM made for your device that you are most certain is perfect. It must be the same Android version!

Step 2

Download and install ES File Explorer or launch it from the app drawer if you have it already installed on your phone. Navigate to the stock ROM you downloaded and extract its contents into a specific folder.

Step 3

In ES File Explorer, enable root explorer and make sure you set the system permission to “RW”.

You can learn how to extract zip files and how to change system permission using ES File Explorer in this tutorial.

Step 4

Now, we are going to swap the malfunctioning system files controlling the sensors on your HTC phone with the perfect one in the stock ROM you downloaded.

In ES File Explorer, you can open multiple tabs for multitasking. In this case, open the system folder in one tab and the extracted folder of the stock ROM in another.

Navigate to the following paths ( or folders) in both opened tabs/folders and swap the following files:

 The files name to be swapped are in bracket

  • i.) System -> bin  (swap “sensorservice” and “akmd8795” files)
  • ii.) System -> etc (swap “sensors.conf” file)
  • iii.) System -> etc -> permissions (swap “android.hardware.sensor.compass.xml”, “”, “android.hardware.sensor.gyroscope.xml”, “android.hardware.sensor.proximity.xml”, “android.hardware.sensor.light.xml”, and “android.hardware.sensor.accelerometer.xml” files)
  • iv.) System -> lib (swap “”, “”, and “” files)
  • v.) System -> lib -> hw (swap “” file)

Step 5

After swapping the files, restart/reboot your phone.

You can confirm if the sensors are working using CPU-Z.

If you face any problem, do let us know by dropping a comment in the below comment box.

Previous articleQualcomm Snapdragon 632, 439 and 429 Mobile Platforms Announced
Next articleNewly Launched LG X2 Packed a Snapdragon Chipset and a 2500mAh Battery

Leave a Reply