-
Notifications
You must be signed in to change notification settings - Fork 274
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
I am currently working with the Cordova Background Geolocation plugin and have encountered an issue where clearPolygon and loadPolygon behave inconsistently. Specifically, I have noticed that: #1469
Comments
You can get more information in the API docs at
![]() |
package com.htpchem.mysafety ---------------------------- |
I appreciate your previous response regarding the behavior of clearPolygon and loadPolygon. However, I have observed inconsistencies when adding geofences, and I would like to clarify the underlying logic. From my logs, I can see that even when my addGeofence method executes successfully, the V [JNI geofencing] loadPolygon big event does not always trigger. I understand that loadPolygon is supposed to be called when the device enters the "containing circular geofence," but in some cases, it does not trigger at all. I would like to understand the exact mechanics behind loadPolygon, specifically: When using addGeofence via a custom method |
The plug-in begins monitoring a polygon when the native, containing circular geofence fires. This containing circular geofence is monitored by the OS. You don’t need to do anything, such as calling .getCurrentPosition. When the OS says you’re inside this circular geofence, the plug-in begins monitoring that polygon. When the OS says you’ve exited, the plug-in stops monitong that polygon. Simple. |
However, I’m noticing an issue in the logs: [V JNI geofencing] loadPolygon big The logs confirm that the plugin has loaded the polygon, yet the ENTER event for that polygon sometimes does not fire (or fires only occasionally). I’d like to understand the exact timing or conditions that trigger the ENTER event for the polygon. From my understanding:
In practice, I see “loadPolygon big” in the logs, but sometimes I do not see the onGeofence(ENTER) event afterward, even though my position is well inside that polygon. Could you clarify the following? When exactly does the plugin decide to dispatch the ENTER event after it loads the polygon? Is there a specific additional location update or an explicit OS callback required for the ENTER event to fire? Do I need to call anything like getCurrentPosition() manually, or should the plugin do that automatically? Is there any minimum movement or time threshold after "loadPolygon" before the plugin will confirm an ENTER? Any insights or best practices about polygon geofences that might explain why ENTER sometimes does not occur would be greatly appreciated. |
The plug-in automatically requests location once per second after you see I suggest you draw your polygon on a map and show it to me. |
I suggest you provide an entire log file from the plug-in. See api docs .emailLog to learn how to obtain the logs. |
I don’t suggest using such a large polygon. It will cause high battery drain while users are within and you’re encompassing an entire neighbourhood. If some user both works and lives in that neighborhood, the location api will often be turned on for long periods of time. You should just use a large circular geofence (or series of smaller ones.) |
package com.htpchem.mysafety ---------------------------- |
I’m not interested in tiny snippets of logs. I want the entire log-file (3 days worth) |
I am currently working with the Cordova Background Geolocation plugin and have encountered an issue where clearPolygon and loadPolygon behave inconsistently. Specifically, I have noticed that:
At times, the clearPolygon log appears, followed by loadPolygon, indicating that the geofence is being reloaded properly.
However, in some instances, only clearPolygon appears, and loadPolygon does not follow, meaning the geofence is not being reloaded as expected.
I would like to understand the underlying logic behind this behavior. In what conditions does loadPolygon fail to execute after clearPolygon? Are there specific scenarios, such as geofence persistence settings, plugin lifecycle states, or API calls, that might prevent loadPolygon from running?
I would greatly appreciate any insights or documentation references regarding this behavior.
The text was updated successfully, but these errors were encountered: