Browse Source

Add temp before destroy

androidx-act-recog
sipp11 5 years ago
parent
commit
86c25967b6
  1. 5
      app/src/main/java/co/zzyzx/sensorlogger/EndlessService.kt

5
app/src/main/java/co/zzyzx/sensorlogger/EndlessService.kt

@ -100,7 +100,7 @@ class EndlessService : Service(), SensorEventListener, LocationListener {
mSensorManager = getSystemService(Context.SENSOR_SERVICE) as SensorManager mSensorManager = getSystemService(Context.SENSOR_SERVICE) as SensorManager
mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER) mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER)
mGyroscope = mSensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE) mGyroscope = mSensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE)
setupActivityRecognitionUpdates() // setupActivityRecognitionUpdates()
if (checkSelfPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { if (checkSelfPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
mLocationManager = getSystemService(Context.LOCATION_SERVICE) as LocationManager mLocationManager = getSystemService(Context.LOCATION_SERVICE) as LocationManager
@ -160,6 +160,9 @@ class EndlessService : Service(), SensorEventListener, LocationListener {
} }
override fun onDestroy() { override fun onDestroy() {
if (dataTemp.size > 0) {
recRepo.addBulkRecord(dataTemp)
}
super.onDestroy() super.onDestroy()
mSensorManager.unregisterListener(this) mSensorManager.unregisterListener(this)
mLocationManager?.removeUpdates(this) mLocationManager?.removeUpdates(this)

Loading…
Cancel
Save