Skip to content

addGeofences method not working #16

@pablog9

Description

@pablog9

I have flutter_background_geolocation + background_geolocation_firebase correctly working (Android) with locations:
My setup looks like this:

BackgroundGeolocationFirebase.configure(BackgroundGeolocationFirebaseConfig(
  locationsCollection: "/vehicles/${_vehicle.id}/locations",  
  geofencesCollection: "/routes/${_currentRoute.id}/geofences",  
  updateSingleDocument: false
));

Locations are working as expected creating a subcollection inside current vehicle document.

Now I am trying to add geofences, adding multiple geofences at once (2 for this example: id: 1, id: 21) to a list:

List<bg.Geofence> geofences = new List<bg.Geofence>();
// foreach step in steps
Bg.Geofence geofence = bg.Geofence(
    identifier: step.index.toString(),
    radius: 200,
    latitude: step.latitude,
    longitude: step.longitude,
    notifyOnEntry: false,
    notifyOnExit: false,
    notifyOnDwell: true,
    loiteringDelay: 30000,
    // 30 seconds
    extras: {"type": step.type});
geofences.add(geofence);
// end foreach
if (geofences.isNotEmpty)
  bg.BackgroundGeolocation.addGeofences(geofences);

But nothing happens, subcollection is never created and these logs are shown:

I/TSLocationManager( 5389): [c.t.l.data.sqlite.GeofenceDAO destroy]
I/TSLocationManager( 5389): ✅ 1
I/TSLocationManager( 5389): [c.t.l.data.sqlite.GeofenceDAO create]
I/TSLocationManager( 5389): ✅ 1
I/TSLocationManager( 5389): [c.t.l.data.sqlite.GeofenceDAO destroy]
I/TSLocationManager( 5389): ✅ 21
I/TSLocationManager( 5389): [c.t.l.data.sqlite.GeofenceDAO create]
I/TSLocationManager( 5389): ✅ 21
D/TSLocationManager( 5389): [c.t.l.g.TSGeofenceManager c] ℹ️ Persist monitored geofences: []

Why are there sqlite references if I am using the firebase version?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions