jccampos jccampos - 1 year ago 76
Android Question

Composite Android sensor not present despite what documentation says

I am using a old phone running android 4.0.4 that has the following sensors (printed by using TYPE_ALL in android studio):

  • Accelerometer Sensor

  • Magnetic Field Sensor

  • Proximity Sensor

  • Orientation Sensor

According to the android documentation on composite sensors this phone should be able to output linear acceleration, however when i ask for it, only null is returned. Other simple sensors such as accelerometer or magnetometer work fine (the basic sensors that are fused to obtain linear acceleration).

The code so far is pretty basic, it's just printing values.

Any idea why this happen? is this standard behavior? Are not all available sensors to a smartphone supposed to be implemented?

Answer Source

The sensors that are specified as hardware/software behave differently according to the sensors available. If https://developer.android.com/guide/topics/sensors/sensors_overview.html#sensors-identify says software, it is the developer responsibility to use the android API to fuse the right basic signals into the composite signal you are looking for.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download