sensor

Using an Android phone's sensors

SDK Version: 
M3

Accessing the sensor data of a phone, is not too complicated, but since API level 3, a lot of things got deprecated. Using only the emulator, you have only a few (here is one) options, to simulate sensor data. I would recommend the use of a physical phone. Keep in mind, that not all phones have the same sensors integrated! Cheaper phones might not have a temperature sensor, or a gyroscope, but I'm pretty sure, that all Android phones have at least an accelerometer, and an orientation sensor.

Here is an example, how to access acceleration and orientation sensor data (in API level 3 and above), without using any deprecated methods.

Syndicate content