Manually triggering permission request for 'Motion & Fitness' in iOS apps

Hello

We are implementing a step counter in our app (iOS/Android), for this feature to work we must prompt the user to allow ‘Motion & Fitness’ permission. But I can’t seem to make this work on demand.

I tried simply activating the feature to make iOS react and show a decision dialogue, but it simply doesn’t do anything. I also noted that the permission only has 2 states in the phone’s app settings, allowed/disallowed, no ask every time option.

InputSystem.EnableDevice(UnityEngine.InputSystem.iOS.LowLevel.iOSStepCounter.current);
                UnityEngine.InputSystem.iOS.LowLevel.iOSStepCounter.current.MakeCurrent();

I approached it this way as that also seems to be the best way to ask for location permissions, simply start the location service and iOS shows the appropriate dialogue, but not here.

Unity’s Application.RequestUserAuthorization only seems to deal with Camera and Microphone, has anyone else figured out an on-demand solution? Also I have already added a motion usage description for iOS in settings, the feature works when a user turns on Motion & Fitness in their settings.

As a i understand this code you pasted would only do something on “unity side” - ios shows this dialog when you are actually using some low level api. Maybe try checking AuthorizationStatus on iOSStepCounter?
Also, you must write “motion usage” string in InputSystem settings