-
Notifications
You must be signed in to change notification settings - Fork 265
Description
Your Environment
-
Plugin version: 4.3.0
-
Platform: Android
-
OS version: 12
-
Device manufacturer / model: Google Pixel 6
-
Flutter info (
flutter doctor):
[✓] Flutter (Channel stable, 2.5.0, on Ubuntu 21.10 5.13.0-28-generic, locale it_IT.UTF-8)
• Flutter version 2.5.0 at /home/beppe/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 4cc385b4b8 (6 mesi fa), 2021-09-07 23:01:49 -0700
• Engine revision f0826da7ef
• Dart version 2.14.0 -
Plugin config:
bg.BackgroundGeolocation.ready(bg.Config(
desiredAccuracy: bg.Config.DESIRED_ACCURACY_HIGH,
distanceFilter: 10.0,
stopOnTerminate: false,
startOnBoot: false,
stopAfterElapsedMinutes: stopAfterMinutes,
debug: kDebugMode,
logLevel: bg.Config.LOG_LEVEL_VERBOSE,
backgroundPermissionRationale: bg.PermissionRationale(
title: translate("location.backgroundPermissionDialog.title"),
message: translate("location.backgroundPermissionDialog.message"),
positiveAction: translate("location.backgroundPermissionDialog.positiveAction"),
negativeAction: translate("location.backgroundPermissionDialog.negativeAction")
),
notificationTitle: translate("location.notification.title"),
notificationText: translate("location.notification.text"),
url: FlavorConfig.instance.values.baseUrl + "driver/location",
method: "PUT",
headers: {"Authorization" : "Bearer ${idToken}"},
httpRootProperty: ".",
extras: {
"timestamp": DateTime.now().millisecondsSinceEpoch ~/1000,
},
locationTemplate: '{"date":"<%= timestamp %>","lat":<%= latitude %>,"lng":<%= longitude %>,"batteryCharge":<%= battery.level %>,"speed":<%= speed %>,"heading":<%= heading %>,"accuracy":<%= accuracy %>,"fakeGps":<%= mock %>}'
)).then((bg.State state) {
if (!state.enabled) {
bg.BackgroundGeolocation.start();
}
});
Context
I need to change the timestamp format used in the location template.
I tried adding an extra param but the value is computed when the config is called and it's not updated at each location update.
Expected Behavior
I would expect that the values in the extras parameter are recalculated at each update.
Actual Behavior
Extras are generated when the config method is called and are not updated.
Is there a way to send the timestamp in a different format?
I need to send the timestamp in epoch format, like 1645455040.