Search Unity

Resolved Android StepCounter stops working after device is put to sleep

Discussion in 'Input System' started by apiotuch_unity, Mar 12, 2021.

  1. apiotuch_unity

    apiotuch_unity

    Joined:
    Jun 28, 2019
    Posts:
    138
    I am currently trying to implement the Input System's step counter which seems to work when the app starts. However when the device is put to sleep and woken up again, the step counter doesn't update anymore. It seems to just have the last set value when the device went to sleep. I an use this line of code to query the step counter:
    Code (CSharp):
    1. StepCounter.current.stepCounter.ReadValue();
    Is this the correct method, or is there additional configuration I need to do at start or whenever the device wakes up again? I do want to get all steps counted, including when the device went to sleep while the app was running.

    Currently using Unity 2019.4.21f1 and Input System 1.0.2.
     
    Last edited: Mar 13, 2021
  2. apiotuch_unity

    apiotuch_unity

    Joined:
    Jun 28, 2019
    Posts:
    138
    I updated to 1.1.0-Preview.3 of the Input System, and that seemed to resolve the issue. And checked for StepCounter.current != null.
     
  3. fareedtahir

    fareedtahir

    Joined:
    Nov 2, 2020
    Posts:
    4
    Hey guys, actually I am using the NatSteps for counting the steps in IOS and Android. It is working for the IOS but not working for Android. Can you just tell me, what are you using for steps count and which platform it targets (like android or IOS)? I need your help to implement this in my android app.
    Thanks in Advance.