Home » Android » huawei – Is it possible to read data from TOF (time-of-flight) sensor on Android?

huawei – Is it possible to read data from TOF (time-of-flight) sensor on Android?

Posted by: admin May 14, 2020 Leave a comment


Recent models of Android phones (Honor View 20, Huawei P30 Pro, Samsung Galaxy 10 5g) have TOF (time-of-flight) sensor. Is it possible to read it through some API or manufacturer SDK?

How to&Answers:

Possible for Huawei using AR Engine SDK


Excerpt of SDK Document AREnginesdk-sample-\HUAWEI AR Engine Function Manual.doc

4.13 Scene mesh
Huawei AR Engine provides real-time output scene mesh
capability. The output includes the pose of the mobile phone in
space. The 3D mesh of the current camera view only supports the
specified Huawei models(Honor V20、P30Pro) that can obtain depth
information, and the supported scanning scene is static.

Excerpt of SDK Document AREnginesdk-sample-\java\HUAWEI AR Engine SDK Interface Manual.docx   ARSceneMesh
•   Description: The class used to return the tracking result when the environment Mesh is tracked. The result includes the Mesh vertex coordinates, the triangle subscript, and so on.
•   Methods: 
public ShortBuffer getSceneDepth()
        // Get the depth image of current frame(optimized).
public int getSceneDepthHeight()
        // Get the height of the depth image.
public int getSceneDepthWidth()
        // Get the width of the depth image.

Possible on Huawei usinga camera2 API


This issue in ARCore contains a lot of information!

Also seems to be possible on S10 5G, but currently not on Note 10+

Excerpt of Night Vision / ToF Viewer app description:

This app is currently working only on Huawei P30 Pro, Honor View 20
and Samsung S10 5G. More devices will start working by future device
software updates.

New features

  • compatibility for Samsung S10 5G added (and maybe for other devices)
  • resolution dialog removed
  • support for front facing removed

Note: There was done a big research for Samsung Note10+ support,
however this device does not seem to support ToF for 3rd party apps.

Another interesting app:

3D scanner app using Huawei ToF sensors


Not possible as of now.
As Android has not included any such APIs in official latest SDKs.

Also those manufactures like Huawei, Samsung and OnePlus are using their customized OS sources and I don’t think they have opened it out.

I was searching for the same and i came across this thread on Samsung community,


Android does include OS level APIs to interact with non-traditional visual cameras. For Samsung S10 5G for example, you can access the camera with the Camera2 API and get a DEPTH16 frame directly. Here is an example: https://medium.com/swlh/working-with-the-3d-camera-on-the-samsung-s10-5g-4782336783c This works with all the Samsung devices, though the example only uses the front-facing ToF camera on the S10 5G. Both S10 and Note 10+ 5G have back facing ToF cameras as well.

I don’t know if Huawei or OnePlus conform to the same API (they theoretically should and other answers indicate that they do to some extent).