Sports GPS application

Hello,
I’m new here on the platform and I’m loving it.
I’m creating a sports GPS application that sends the location to a web api. however, I can’t find a way to get it to send data when the screen is locked. can you give a tip?
Thanks

Have you tried to change the device location settings for the app to “always allow” location to be accessed instead of just while using the app?

is this defined in the build Permissions?
in the phone dont have “always allow”.
after installed only the option “while using the app” appears

You should be able to go into your phone settings and then change the settings for a specific app to always allow.

take a look here because its not possible

there are so many applications that use the gps even with the cell phone blocked.
what is the use of the GPS if it cannot be used?