Usually, in Android, we read the accelerometer data in an "Activity", by overriding the OnSensorChanged function.
I am curious how we can do it in a "Service".
Thanks, Vincent
Usually, in Android, we read the accelerometer data in an "Activity", by overriding the OnSensorChanged function.
I am curious how we can do it in a "Service".
Thanks, Vincent
Actually
OnSensorChanged(SensorEvent event)
is method from interface SensorEventListener.So if you want to do it in service; you make your new class that extends
Service
and implementsSensorEventListener
.You can do exactly the same in a Service as well.