File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
library/src/main/java/com/android/gpstest/library/data Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -52,8 +52,10 @@ private const val TAG = "SharedSensorManager"
52
52
class SharedSensorManager constructor(
53
53
private val prefs : SharedPreferences ,
54
54
private val context : Context ,
55
- externalScope : CoroutineScope
55
+ externalScope : CoroutineScope ,
56
56
) {
57
+ private val ROT_VECTOR_SENSOR_DELAY_MICROS = 10 * 1000 // 100Hz updates
58
+
57
59
// Holds sensor data
58
60
private val rotationMatrix = FloatArray (16 )
59
61
private val remappedMatrix = FloatArray (16 )
@@ -132,15 +134,15 @@ class SharedSensorManager constructor(
132
134
sensorManager.registerListener(
133
135
callback,
134
136
vectorSensor,
135
- SensorManager . SENSOR_DELAY_FASTEST
137
+ ROT_VECTOR_SENSOR_DELAY_MICROS
136
138
)
137
139
} else if (SatelliteUtils .isOrientationSensorSupported(context)) {
138
140
// Use the legacy orientation sensors
139
141
val sensor: Sensor = sensorManager.getDefaultSensor(Sensor .TYPE_ORIENTATION )
140
142
sensorManager.registerListener(
141
143
callback,
142
144
sensor,
143
- SensorManager . SENSOR_DELAY_GAME
145
+ ROT_VECTOR_SENSOR_DELAY_MICROS
144
146
)
145
147
} else {
146
148
// No sensors to observe
You can’t perform that action at this time.
0 commit comments