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

Possible for Huawei using AR Engine SDK

https://developer.huawei.com/consumer/en/ar

Excerpt of SDK Document AREnginesdk-sample-2.0.0.6\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-2.0.0.6\java\HUAWEI AR Engine SDK Interface Manual.docx

2.2.1.18.   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

https://github.com/google-ar/arcore-android-sdk/issues/120#issuecomment-535413944

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 https://play.google.com/store/apps/details?id=com.lvonasek.arcore3dscannerpro


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).