flutter_background_geolocation icon indicating copy to clipboard operation
flutter_background_geolocation copied to clipboard

Guidance on How to reconnect to http server after failure

Open yashhema opened this issue 3 years ago • 2 comments

Your Environment

  • Plugin version:4.3.0
  • Platform: Android
  • OS version:11
  • Device manufacturer / model: OnePlus 6
  • Flutter info (flutter doctor):
  • [√] Flutter (Channel unknown, 2.10.0, on Microsoft Windows [Version 10.0.22000.613], locale en-US) • Flutter version 2.10.0 at D:\NewAppJun29.fvm\flutter_sdk • Upstream repository unknown • Framework revision 5f105a6ca7 (3 months ago), 2022-02-01 14:15:42 -0800 • Engine revision 776efd2034 • Dart version 2.16.0 • DevTools version 2.9.2
  • Plugin config:
    var conf = bg.Config(
        desiredAccuracy: bg.Config.DESIRED_ACCURACY_HIGH,

        backgroundPermissionRationale: bg.PermissionRationale(
            title:
            "Allow {applicationName} to access this device's location even when the app is closed or not in use.",
            message:
            "This app collects location data to enable recording your trips to work and calculate distance-travelled.",
            positiveAction: 'Change to "{backgroundPermissionOptionLabel}"',
            negativeAction: 'Cancel'),
        //locationUpdateInterval: 5000,
        activityType: Config.ACTIVITY_TYPE_OTHER_NAVIGATION,
        distanceFilter: 20,
        stopOnTerminate: true,
        startOnBoot: true,
        debug: true,
        autoSync: true,
        autoSyncThreshold: 1,
        locationsOrderDirection: "DESC",
        maxDaysToPersist: 1,
        url: murl,
        extras: httpcallableformat,
        headers: {
          "Authorization": "Bearer ${authtoken}"
        },

        logLevel: bg.Config.LOG_LEVEL_VERBOSE);

Expected Behavior

I understand from documentation, that app will disconnect from http servers in case bad response is received I am not clear ,how the app should try to reconnect to http server

Actual Behavior

App disconnects on http failure doesnt reconnect back

Steps to Reproduce

  1. Shutdown the http server

Context

Reconnect to http server

Debug logs

Logs
http failed

yashhema avatar Apr 30 '22 06:04 yashhema

http server after failure

What kind of failure? The plugin attempts a new http request after each recorded location.

By the way, autoSyncThreshold: 1 is pointless. Just delete that option.

Also see api docs for event onHttp.

christocracy avatar Apr 30 '22 14:04 christocracy

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You may also mark this issue as a "discussion" and I will leave this open.

stale[bot] avatar Sep 21 '22 05:09 stale[bot]