Android Type_Linear_Acceleration Sensor - What Does It Show

How are Android sensor TYPE_LINEAR_ACCELERATION and TYPE_ROTATION_VECTOR implemented?

Is the source code available somewhere?

Unfortunately, the Fused Location Provider API is not a part of the Android Open Source Project but rather it's implemented as a part of Google Play Services which is a proprietary Google software and it's source code is not publicly available. In fact, the FusedLocationProviderApi.java interface implementations are purposedly obfuscated, for example:

public class zzd implements FusedLocationProviderApi {
public zzd() {
}

public Location getLastLocation(GoogleApiClient var1) {
zzl var2 = LocationServices.zzj(var1);

try {
return var2.getLastLocation();
} catch (Exception var4) {
return null;
}
}
...

How have they been implemented?

Since the source is not available, we may only speculate on how exactly it's implemented.

Android Sensor.TYPE_LINEAR_ACCELERATION reporting wrong values on Galaxy S5

=== New answer ===

I have seen that a change the sampling rate of the sensor did the trick in avoiding this error. From the probable SensorManager.SENSOR_DELAY_FASTEST to SensorManager.SENSOR_DELAY_UI

=== Old Answer ===

Given my 2 comments on your question and because of having the same problem on 2 other Galaxy 5S', at the present moment, and with regard to the goal which is detecting the telephone's stillness, I can only suggest 2 workarounds: a peak-to-peak value consideration, and a high pass filter.

  1. Peak-to-peak Value Consideration: just measure the difference between the last 2 readings; if this is bigger than a threshold then a movement event can be triggered.
  2. High Pass Filter: slightly more complicated, but more professional, implement in your code such a filter that will only bring forward rapid changes in the acceleration, while suppressing the constant value of 19.

TYPE_LINEAR_ACCELERATION and TYPE_GRAVITY not working

OK, by applying the first rule of engineering and general common sense the problem was solved :) Just turned it off and on again, and now it automagically works. This is a bit troubling though, because it means I have no way of knowing if the sensors are working properly other than using a timeout thread to verify periodic updates.



Related Topics



Leave a reply



Submit