react-native-background-geolocation icon indicating copy to clipboard operation
react-native-background-geolocation copied to clipboard

Allow app to access your physical activity with disabled disableMotionActivityUpdates flag

Open DzianisAleshkou opened this issue 2 years ago • 17 comments

Your Environment

  • Plugin version: 4.12.1
  • Platform: Android
  • OS version:
  • Device manufacturer / model:
  • React Native version (react-native -v): 0.69.10
  • Plugin config
export const locationConfig = {
  desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
  stationaryRadius: 15, // <-- Default: 25. When stopped, the minimum distance the device must move beyond the stationary location for aggressive background-tracking to engage.
  distanceFilter: 10, // <-- The minimum distance (measured in meters) a device must move horizontally before an update event is generated.
  title: "App is Running in Background.",
  text: "",
  debug: false,
  startOnBoot: false, // <-- Auto start tracking when device is powered-up.
  stopOnTerminate: false, // <-- Allow the background-service to continue tracking when user closes the app.
  locationAuthorizationRequest: "Always",
  backgroundPermissionRationale: {
    title: "...",
    message: `...`,
    positiveAction: "..."
  },
  locationUpdateInterval: 5000,
  disableMotionActivityUpdates: true
};

Expected Behavior

modal does not appear in app

Actual Behavior

I see this modal in app with disableMotionActivityUpdates: true image and I init service after BG.ready() image

Steps to Reproduce

Context

Debug logs

Logs
PASTE_YOUR_LOGS_HERE

DzianisAleshkou avatar Jul 12 '23 15:07 DzianisAleshkou

I cannot reproduce this.

Either you are:

  1. calling .start() before calling .ready(config)
  2. Configuring the plugin with reset: false
  3. Some other plugin is requesting Motion permission.

If the plugin is configured with disableMotionActivityUpdates: false (ie: do NOT disable), you will see this in the logs:

07-12 11:47:33.004 11961 12103 D TSLocationManager:   🎾  Start monitoring connectivity changes

christocracy avatar Jul 12 '23 15:07 christocracy

(Mistake above)

If the plugin is configured with disableMotionActivityUpdates: false (ie: do NOT disable), you will see this in the logs:

07-12 11:54:23.386 13693 13823 I TSLocationManager: 🎾 Start motion-activity updates

christocracy avatar Jul 12 '23 15:07 christocracy

@christocracy 2. Configuring the plugin with reset: false It works. Thank you. Can be closed

DzianisAleshkou avatar Jul 14 '23 08:07 DzianisAleshkou

Why were you hiding that Config and not showing it here?

christocracy avatar Jul 14 '23 11:07 christocracy

@christocracy Actually 2. Configuring the plugin with reset: false didn't help. Modal appears ifdisableMotionActivityUpdates: true and reset: false. my config image this from my app permissions. How can I remove "Physical Activity" permission from app. I do not use another location service. image

DzianisAleshkou avatar Aug 15 '23 13:08 DzianisAleshkou

I don't think you understand what reset: false is. 99% of users should not use reset: false. It causes the plugin to IGNORE the Config provided to ready(config).

christocracy avatar Aug 15 '23 14:08 christocracy

@christocracy when I do not use 'reset: false' modal with 'physical activity' permission appears if disableMotionActivityUpdates is true

DzianisAleshkou avatar Aug 15 '23 15:08 DzianisAleshkou

@christocracy How can I remove 'Physical Activity' permission on native level?

DzianisAleshkou avatar Aug 15 '23 15:08 DzianisAleshkou

I have no idea what you're doing wrong, but you're doing something wrong.

Create for me a simple HelloWorld that reproduces this. Share your simple HelloWorld in a public github repo here.

christocracy avatar Aug 15 '23 15:08 christocracy

Do NOT use reset: false.

christocracy avatar Aug 15 '23 15:08 christocracy

Why does "Physical Activity" permission display in permissions settings?

DzianisAleshkou avatar Aug 15 '23 15:08 DzianisAleshkou

Because that permission is included in the plugin's own AndroidManifest

<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />

christocracy avatar Aug 15 '23 15:08 christocracy

Can I see it in node_modules?

DzianisAleshkou avatar Aug 15 '23 15:08 DzianisAleshkou

no.

christocracy avatar Aug 15 '23 15:08 christocracy

but if app does not use it, why is it important setting?

DzianisAleshkou avatar Aug 15 '23 15:08 DzianisAleshkou

If your issue is the Physical Activity permission is being requested in spite of disableMotionActivityUpdates: true, you're doing something wrong.

Create for me a simple HelloWorld app which reproduces the problem.

christocracy avatar Aug 15 '23 15:08 christocracy

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

github-actions[bot] avatar May 17 '24 01:05 github-actions[bot]

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

github-actions[bot] avatar May 31 '24 01:05 github-actions[bot]