transistorsoft / react-native-background-geolocation

Sophisticated, battery-conscious background-geolocation with motion-detection
http://shop.transistorsoft.com/pages/react-native-background-geolocation
MIT License
2.66k stars 425 forks source link

Manually request motion permissions #2098

Closed sirusbaladi closed 1 month ago

sirusbaladi commented 4 months ago

Hi,

I'm aware that there's a method to manually trigger location permissions, is there a similar way to trigger the permission for the motion sensors?

The expo library to do so seems to not work and I like to request the permission during user onboarding one by one.

thank you

sirusbaladi commented 3 months ago

bump

sanduluca commented 3 months ago

I guess you can use https://github.com/zoontek/react-native-permissions and ask for PERMISSIONS.IOS.MOTION PERMISSIONS.ANDROID.ACTIVITY_RECOGNITION

github-actions[bot] commented 2 months ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 1 month ago

This issue was closed because it has been inactive for 14 days since being marked as stale.

MufeedaFi commented 3 days ago

Yes, we can manually request using https://github.com/zoontek/react-native-permissions but is there a way to disable the default pop-up for "Motion&Fitness" permission within package?

christocracy commented 3 days ago

is there a way to disable the default pop-up for "Motion&Fitness" permission within package?

do you understand the consequences of the plug-in not having motion permission? They are not minor.

MufeedaFi commented 3 days ago

is there a way to disable the default pop-up for "Motion&Fitness" permission within package?

do you understand the consequences of the plug-in not having motion permission? They are not minor.

Would it be affected if we handle that permission explicitly? ie, for eg; by requesting it during onboarding manually as we need a custom screen only for handling that, and disabling the default request pop-up from geolocation package?

christocracy commented 3 days ago

See API docs Config.disableMotionActivityUpdates. Set it to false. Once you have Motion Permission, set it to true using .setConfig.

MufeedaFi commented 3 days ago

See API docs Config.disableMotionActivityUpdates. Set it to false. Once you have Motion Permission, set it to true using .setConfig.

Hey, don't really understand.

My requirement is that, the "Motion and fitness" permission should ONLY be asked only when user clicks a button "Enable permission" and it should NOT be asked implicitly just beacuse I use the package. And the way to disable the one from package is to set disableMotionActivityUpdates: true. And then I can request that permission manually using react-native-permissions as required on the button click.

So, my question is, will this approach has any consequences of the plug-in not having motion permission? Or will this affects the geolocation lib functionalities somehow?

christocracy commented 3 days ago

will this approach has any consequences of the plug-in not having motion permission?

no. The plugin doesn't care how permission is achieved. Permissions are granted to your app.

MufeedaFi commented 3 days ago

will this approach has any consequences of the plug-in not having motion permission?

no. The plugin doesn't care how permission is achieved. Permissions are granted to your app.

Ok, so this approach is fine I think. Thank you!

mikehardy commented 3 days ago

https://github.com/zoontek/react-native-permissions?tab=readme-ov-file#ios

By default, no permissions are available

(followed by lots of detailed setup instructions - I'm guessing something is missed)