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