50Hz is nowhere near the capacity of the CPU to handle sensor data. I've run 2000 Hz on an ARM-7 and still had cycles to spare for other tasks. You'll need to create your own (C-code) ISR which loads values into a circular buffer and then unload the buffer from the Java side, passing the pointer to the buffer via JNI.
Of course, you will need to root the phone and rebuild the kernel and it will only ever work on rooted phones with your special kernel but it's totally doable. On Nov 18, 8:25 am, babak <[email protected]> wrote: > Thank you for your answer, > Actually, I am using the HTC Desire and I just reach to 5Hz sampling > rate with Java-API. But it is too low for me. Do know how to reach to > 50Hz, it is not important whether by using standard API, JNI, or > working on the my phone's kernel. Actually, It is also Ok for me, if I > can reach to this performance just in my phone. > > Regards. > Babak > > On Nov 17, 9:04 pm, ip332 <[email protected]> wrote: > > > Short answer: no, you can't read sensors directly. With some hacking > > steps and couple of weeks of hard work you might be able to duplicate > > Android's Sensors JNI with exactly the same (or even worse) > > performance which will work only on your super-rooted-hacked-one-of-a- > > kind phone. Why bother? > > > With respect to the second question: yes, you can, but the maximum > > speed is device (driver) dependent and sometimes could be too high for > > the device. I mean that reading sensors is not the final goal and you > > need to keep some CPU to process that data, right? > > Anyway, you need to start from reading Android > > documentation:http://developer.android.com/reference/android/hardware/SensorManager..., > > android.hardware.Sensor, int) > > > On Nov 13, 12:24 pm, babak <[email protected]> wrote: > > > > Hello all, > > > > I am looking for a way to get sensors' data ( especially > > > Accelerometer) directly without using Listener approach. Actually I > > > need to have the data really fast!!! > > > > I can not find any way to read sensor data by myself. Anybody knows > > > anything about it? > > > Is it possible to read data with more than 50Hz? > > > > Regards, > > > Babak -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

