heartbeatInterval property

int? heartbeatInterval
getter/setter pair

Controls the rate (in seconds) the BackgroundGeolocation.onHeartbeat event will fire.

WARNING:

  • On iOS the heartbeat event will fire only when configured with preventSuspend: true.
  • Android minimum interval is 60 seconds. It is impossible to have a heartbeatInterval faster than this on Android.

See also: BackgroundGeolocation.onHeartbeat

Example

BackgroundGeolocation.ready(Config(
  heartbeatInterval: 60
));

BackgroundGeolocation.onHeartbeat((HeartbeatEvent event) {
  print('[onHeartbeat] ${event}');

  // You could request a new location if you wish.
  BackgroundGeolocation.getCurrentPosition(
    samples: 1,
    persist: true
  ).then((Location location) {
    print('[getCurrentPosition] ${location}');
  });
})

Implementation

int? heartbeatInterval;