transistorsoft / flutter_background_geolocation_firebase

Firebase proxy for Flutter Background Geolocation SDK
MIT License
21 stars 7 forks source link

What's the expected behaviour of flt_background_geolocation Config.locationTemplate #15

Closed iDeliverDev closed 4 years ago

iDeliverDev commented 4 years ago

Should the locationTemplate affect what's getting stored in firebase or is it assumed that all processing will happen in Cloud Functions?

Here's how we are configuring (everything is working perfectly but the stored data is not in the structure we expected).

bg.Config config = bg.Config(
  desiredAccuracy: bg.Config.DESIRED_ACCURACY_HIGH,
  distanceFilter: 3,
  logLevel: bg.Config.LOG_LEVEL_WARNING,
  locationTemplate: '{"lat":<%= latitude %>,"lng":<%= longitude %>,"ts":"<%= "timestamp" %>","id":<%= "uuid" %>,"acc":<%= accuracy %>}',
  extras:{"user-id":userId}
);

await BackgroundGeolocationFirebase.configure(BackgroundGeolocationFirebaseConfig(
  locationsCollection: "/idriver/events/incoming",
  geofencesCollection: "geofences",
  updateSingleDocument: false,
));
await bg.BackgroundGeolocation.ready(config);
christocracy commented 4 years ago

Should the locationTemplate affect what's getting stored in firebase

No. When using Firebase Adapter, locationTemplate is ignored. You must use Firebase Cloud Functions to reformat the data as desired.