transistorsoft / flutter_background_geolocation

Sophisticated, battery-conscious background-geolocation & geofencing with motion-detection
https://www.transistorsoft.com/shop/products/flutter-background-geolocation
Other
651 stars 242 forks source link

Android: the addGeofence function only accepts double greater or equal to 150m #1300

Closed achrafroui closed 6 months ago

achrafroui commented 6 months ago

Your Environment

• No issues found!

{ Future.forEach( listOfZones, (ZoneModel zone) async => { if (List.of(await bg.BackgroundGeolocation.geofences) .map((e) => e.identifier) .toList() .contains(zone.uid) == false) { if (zone.uid != null) { await addGeofence(zone), } } }); } Future addGeofence(ZoneModel zone) async { log('fromAddGeofence: ${zone.geoRad!}'); // zone.geoRad! is between 40.0 and 176.0 => only 176.0 is added correctly and all the others are added 150.0m await bg.BackgroundGeolocation.addGeofence(bg.Geofence( identifier: zone.uid!, radius: zone.geoRad!, latitude: zone.geoLat!, longitude: zone.geoLong!, notifyOnEntry: false, // only notify on entry notifyOnExit: true, notifyOnDwell: true, loiteringDelay: 5000, // 5 seconds extras: {'name': zone.geoName})).then((bool success) { log('[addGeofence] ${zone.geoName} success'); }).catchError((error) { log('[addGeofence] FAILURE: $error'); }); }


## Expected Behavior
Radius should be added correctly. I tested it on IOS and everything works fine.

## Actual Behavior
<!--- Tell us what happens instead -->
When i add a radius less than 150m, it is added 150.0m istead
## Steps to Reproduce
<!--- reproduce this issue; include code to reproduce, if relevant -->
1.
2.
3.
4.

## Context
<!--- What were you trying to do? -->

## Debug logs
<!-- include iOS / Android logs
- ios XCode logs,
- use #getLog #emailLog methods (@see docs)
- Android: $ adb logcat -s TSLocationManager
-->
<details>
    <summary>Logs</summary>

``` <!-- syntax-highligting:  DO NOT REMOVE -->
I/flutter (14419): LISTOFGEOFENCES1: (176.0, 150.0, 150.0, 150.0, 150.0, 150.0, 150.0)
I/flutter (14419): LISTOFGEOFENCES2: (40.0, 40.0, 40.0, 40.0, 40.0, 176.0, 40.0)

christocracy commented 6 months ago

the addGeofence function only accepts double greater or equal to 150m

That’s correct. The minimum radius the native geofencing apis respond to is 150 meters.

it doesn’t matter if you were to set it to zero — the native api will operate as if it were 150.