Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Help Wanted]: We need on-going device tracking on 2000 meters, and when stop the device motion, we need to track after 20 minutes, So which parameters pass on bg.Config method #1424

Open
3 tasks done
PiyushPoshiya opened this issue Feb 12, 2025 · 7 comments
Labels

Comments

@PiyushPoshiya
Copy link

Required Reading

  • Confirmed

Plugin Version

4.15.5

Mobile operating-system(s)

  • iOS
  • Android

What do you require assistance about?

I need to require parameters to pass on the BG.Config method, so please give me parameters with value

[Optional] Plugin Code and/or Config

// Configure the plugin
    bg.BackgroundGeolocation.ready(
      bg.Config(
        locationAuthorizationRequest: 'Always',
        disableLocationAuthorizationAlert: false,
        disableMotionActivityUpdates: false,
        // backgroundPermissionRationale: bg.PermissionRationale(
        //     title: "Give me Location bro",
        //     message: "I want you for testing",
        //     positiveAction: "Click here",
        //     negativeAction: "Don't click here"),
        // stationaryRadius: 200,
        // minimumActivityRecognitionConfidence: 75,
        desiredAccuracy: bg.Config.DESIRED_ACCURACY_HIGH,
        distanceFilter: 500,
        // Set distance filter to 100 meters
        disableElasticity: true,
        preventSuspend: true,
        stopOnTerminate: false,
        startOnBoot: true,
        debug: false,
        logLevel: bg.Config.LOG_LEVEL_VERBOSE,
        foregroundService: true,
        forceReloadOnLocationChange: true,
        geofenceModeHighAccuracy: true,
        forceReloadOnGeofence: true,
        forceReloadOnMotionChange: true,
        forceReloadOnBoot: true,
        isMoving: true,
        enableHeadless: true,
        showsBackgroundLocationIndicator: false,
        stopOnStationary: false,
        pausesLocationUpdatesAutomatically: false,
        stopTimeout: 300000000,
        stopAfterElapsedMinutes : 300000000,
        disableStopDetection: true,
        //new
        heartbeatInterval: 150,
        // heartbeatInterval: 300, // 5 minutes for stationary updates
        activityRecognitionInterval: 600000, // Check activity every 10 seconds
        // Server endpoint
        url: 'https://936hd6ds-5000.use.devtunnels.ms/location',

        // Authorization header
        headers: {
          'Authorization':
          'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOjIxLCJleHAiOjE3Mzc1NjU0Mzh9.WR5N0PbUAG2X8JGTF4GOxCNv43ALvDWY_dYmZbxU34c',
          'Content-Type': 'application/json',
        },

        // Parameters to send with each location
        params: {
          "trackingId": trackingID,
        },
        extras: {
          "trackingId": trackingID,
        },

        // Sync and HTTP settings
        autoSync: true,
        // Automatically send locations to the server
        method: 'POST', // HTTP POST method
      ),
    ).then((bg.State state) async {
      if (!state.enabled) {
        // Start the plugin if it's not already running
        await bg.BackgroundGeolocation.start();
      }
    });
  } catch (e) {}
}

[Optional] Relevant log output

@christocracy
Copy link
Member

foregroundService: true,
forceReloadOnLocationChange: true,
geofenceModeHighAccuracy: true,
forceReloadOnGeofence: true,
forceReloadOnMotionChange: true,
forceReloadOnBoot: true,

These options are all deprecated and no longer used. Where did you get the idea to use these?

We need on-going device tracking on 2000 meters

What exactly does this mean? You only need to track the device for exactly 2km then you’re no longer interested in tracking??

and when stop the device motion, we need to track after 20 minute

See api docs Config.stopTimeout.

@PiyushPoshiya
Copy link
Author

i need to get location on continuous 2 km and when stop truck or not to any movement, then get location after 20 minutes

@PiyushPoshiya
Copy link
Author

can i get motion activity if the device is available or not?

@christocracy
Copy link
Member

Search API docs

i need to get location on continuous 2 km and when stop truck or not to any movement, then get location after 20 minutes

  • search API docs distanceFilter
  • search API docs stopTimeout

can i get motion activity if the device is available or not?

Search API docs event .onActivityChange

@PiyushPoshiya
Copy link
Author

When I use onActivityChange this method, then how do I get location coordinates?
On this.onActivityChange method we get only event for (still, on_foot, in_vehicle, on_bicycle, running)
but not get to location

@christocracy
Copy link
Member

I suggest you read the api docs and learn about all 13 events available to you, including .onLocation.

This plug-in is heavily event-based.

Copy link

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

@github-actions github-actions bot added the stale label Mar 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants