Access Android sensors via NDK

MQS picture MQS · Nov 17, 2010 · Viewed 16.1k times · Source

I need read about 100 samples per second off the accelerometer on a Android, and at a fixed sample rate. The current sensormanager does or offers neither.

I've read Need to read android sensors really fast

He seems to have access to the driver code which made his life easier.

I am curious if anyone has been able to do something like this through the NDK w/o that type of knowledge.

Thanks in advance!

Answer

Madmartigan picture Madmartigan · Mar 4, 2011

I have taken a look at sensor.h, and the API looks very promising; however, a little howto on how to deal with the ASensorEventQueue and ASensorEventQueue_hasEvents and so forth would be -extremely- useful.

Ha! Update:

This looks a code example for what you want to do.

http://developer.android.com/reference/android/app/NativeActivity.html