YS Wang
YS Wang

Reputation: 187

Is possible get sensor value directly?

Is it possible to get sensor value directly?

I've read Android Developer page's introduction and search some relative information on Internet But it seems register the listener is the only way to get sensor value?

But this kind of solution can not meet my project requirement I need to get the first set of data value even the sensor didn't detect any value change Use the listener, it can't get any value while no value changed...

Upvotes: 1

Views: 1639

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006539

But it seems register the listener is the only way to get sensor value?

Correct. You are welcome to register a listener, then unregister it after you get your first value, if you like. However, bear in mind that sensors tend to be "noisy", and so you may be better served getting a number of sensor readings, then averaging them or otherwise smoothing the data.

Upvotes: 3

Related Questions