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

Advice for distance and time interval #69

Open
randy-johnson opened this issue Apr 29, 2017 · 7 comments
Open

Advice for distance and time interval #69

randy-johnson opened this issue Apr 29, 2017 · 7 comments

Comments

@randy-johnson
Copy link

Your Environment

  • Plugin version: 1.4
  • Platform: Android
  • OS version: 7
  • Device manufacturer / model: GenyMotion / 6P
  • Nativescript version (tns info): 2.5.3
  • Plugin config

I am wondering what config options I would use to have the app communicate every 50 meters and then perhaps every 15 minutes if the app doesn't move more than 50 meters?

I have distanceFilter: 50,

I was thinking maybe this: locationUpdateInterval but the docs make it sound like distanceFilter has to be 0.

heartbeat interval sounds like it could be a possibly too.

Thank You,

Randy

@randy-johnson
Copy link
Author

@christocracy, pinging you on this since it has been a couple days. Thank You

@christocracy
Copy link
Member

distanceFilter: 50, heartbeatInterval: 60*15}. Listen to heartbeat event.

Simulator is not the best way to test the plugin. The plugin relies on accelerometer-based Motion-detection APIs to decide when to start recording locations. Simulators don't have accelerometers.

If you want the plugin to record locations in Simulator, you have to manually tell the plugin to change to "moving" state with changePace(true).

@randy-johnson
Copy link
Author

Thank you. I was able to use a batch file script using genyshell.exe to feed latitude and longitude to the emulator along with the ChangePace(true) to simulate movement.

@randy-johnson
Copy link
Author

@christocracy,

I wanted to follow up on this. This configuration works awesome in Android but not IOS.

        desiredAccuracy: 0,
        distanceFilter: 50,
        heartbeatInterval: 60*15,
        foregroundService: false,

I have 2 questions:

  1. Will the above configuration still allow the ios app to communicate on distance changes when the app is minimized? Currently my app only seems to be communicating with my server when the app is open so I want to make sure I am not missing some config settings here.

  2. I was reading in the docs that in order to use heartbeat interval on IOS that I have to use preventSuspend = true which is a bad idea because of battery. Does IOS ignore the setting since I am not using preventSuspend?

Thank You,

@randy-johnson randy-johnson reopened this Dec 10, 2017
@christocracy
Copy link
Member

There is no heartbeat on iOS without preventSuspend.

When iOS app is placed in background while in stationary state, iOS has suspended your app.

When the iOS device moves about 200 meters beyond last know location, iOS will awaken your app, the plugin will turn on location services and your app is now completely alive in background (just as if it was running in foreground). It will stay alive, recording a location each distanceFilter meters until the device is detected to have become stationary, when the plugin will initiate the stopTimeout timer. When stopTimeout elapses, the plugin will turn off location-services and iOS will immediately put your app to sleep. And the whole cycle begins again.

@DeejayEaster
Copy link

DeejayEaster commented Jun 9, 2023

There is no heartbeat on iOS without preventSuspend.

When iOS app is placed in background while in stationary state, iOS has suspended your app.

When the iOS device moves about 200 meters beyond last know location, iOS will awaken your app, the plugin will turn on location services and your app is now completely alive in background (just as if it was running in foreground). It will stay alive, recording a location each distanceFilter meters until the device is detected to have become stationary, when the plugin will initiate the stopTimeout timer. When stopTimeout elapses, the plugin will turn off location-services and iOS will immediately put your app to sleep. And the whole cycle begins again.

So, anytime I lock my iphone, distanceFilter is no longer being respected? Is this why? I am still getting GPS captures, just not with the accuracy my config suggests. From my understanding preventSuspend only affects heartbeatInterval, but without preventSuspend my gps does not capture at the correct intervals.

@christocracy
Copy link
Member

So, anytime I lock my iphone, distanceFilter is no longer being respected?

The plug-in doesn’t care if your phone is locked. If the device moves at least 200 meters, the plug-in begins tracking, even if your phone is locked and in your pocket.

but without preventSuspend my gps does not capture at the correct intervals.

The plug-in does not require preventSuspend to operate. You just need to go outside and move at least 200 meters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants