Need to read android sensors really fast

前端 未结 5 1429
臣服心动
臣服心动 2021-02-05 07:55

Issue:-

  1. I am developing a application which needs a new acceleration datum every 5 millisecond.

My Approach:-

5条回答
  •  萌比男神i
    2021-02-05 08:20

    For people referencing this post today, while I think @robinr has a good point and is very true, that is not an answer, however stackoverflow wont let me comment on it directly.

    For answers to the first question reference Native Activity. And. Android does not guarantee data rate, it only makes sure that you get the minimum (or maximum if you requesting too much).

    The accelerometer is Not noisy, at least not today. Its just way too good at picking up EVERYTHING. So you need to use some filtering if you want a good accelerometer algorithm. If you have excellent filters, accelerometer is actually preferable to all else because it is usually a lower power sensor, has the highest supported frequency, and is most likely to be available when the screen is off(compared to other sensors).

    The caveat to a forceful method of using native and extracting the highest frequency is that your device support will be limited. This is why Android doesn't support direct frequency settings.

    In response to question 2; your going to have to throttle your sensor events manually by monitoring the timestamp.

提交回复
热议问题