how can I create a new hardware device sensor in Android?

158 views Asked by At

I am an electronic engineer and I have also experience developing Android apps (Activity, services, broadcast...).

Currently, I am trying to read the data of an ambient ligth sensor BH1750 connected by i2c in a JAVA app, using a snapdragon 845 development board as this one. The snapdragon runs Android 9 Pie based on kernel v4.9.

I know how to use the sensor framework to read values from the sensors in an JAVA app, using the SensorManager class, listener and the corresponding callbacks such as onSensorChange. However, I don't know how to set up or configure the BH1750 sensor to be recognised by the Android system and define it as TYPE_LIGTH to be able to use the sensor framework in a JAVA app.

I have found the driver of the BH1750 sensor for Android systems, it is here.

How can I add the sensor driver to Android? Where should I place the driver within the file system?

Once the driver is set to the kernel, how can I configure the Hardware Abstraction layer (HAL) to recognise the sensor from the JAVA app?

Thank you in advance!

0

There are 0 answers