Read android sensors (step_counter)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By potatofre4k

Hi, I would like to read the step counter from my game running on android. I know the sensor is available on Android, but not sure the best way to read/expose to my Godot game. I think I should use the SensorEventListener, but didn’t find good documentation on that other than related to the accelerometer.

This is a link of the sensor on Android:
https://developer.android.com/reference/android/hardware/Sensor#TYPE_STEP_COUNTER

yes , i was doing some research , to create a pedometer , it’s true godot have accelerometers but it limited “even if you create pedometer from 0 , you will face the fact android kill the app after some time …it not keep activity in the background or lock or sleep mode” , because of security system , private use info , battery drain , the best way to use step counter , step detector is to create android plugin , to pass some functions
to deals with sensors , motion sensors , SensorManager , SensorEvent , JobScheduler ,
and functions to make sure to disable sensors at the time it not in use so it don’t drain the battery in just a few hours , the system will not disable sensors automatically when the screen turns off …
i maybe be wrong … i hope some one can make plugin for physical activity on android
also there this app Health Connect (Beta) from Samsung and google , if you get the steps data maybe it work ? didn’t try this method … i hope it work for you

Sorano Sakura | 2023-01-22 22:35