preventSuspend property

bool preventSuspend
read / write

[iOS only] Prevent iOS from suspending your application in the background after location-services have been switched off.

Defaults to false. Set true to prevent iOS from suspending your application after location-services have been switched off while running in the background. Must be used in conjunction with a heartbeatInterval.

Note: When a device is unplugged form power with the screen off, iOS will still throttle BackgroundGeolocation.onHeartbeat events about 2 minutes after entering the background state. However, if the screen is lit up or even the slightest device-motion is detected, BackgroundGeolocation.onHeartbeat events will immediately resume.

WARNING: preventSuspend: true should only be used in very specific use-cases and should typically not be used as it will have a very noticeable impact on battery performance. You should carefully manage preventSuspend, engaging it for controlled periods-of-time. You should not expect to run your app in this mode 24 hours / day, 7 days-a-week.


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

  preventSuspend: true,
  heartbeatInterval: 60


bool preventSuspend