What just happened?

We just created a basic sensor algorithm to detect the phone handling event by processing the gyroscope values in the background service. As a best practice, it's suggested that you don't not block the onSensorChanged() method. In our onSensorChanged() method callback, we are just doing very simple calculations that will be completed before the next callback arrives. If you have any doubt in about whether it's a simple calculation or a complex one, then the best way is to log the time before and after the calculation, and compare it with the time interval between the callbacks.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset