removeListeners static method
Remove all event-listeners registered with the plugin:
- onLocation
- onMotionChange
- onActivityChange
- onProviderChange
- onGeofencesChange
- onGeofence
- onHeartbeat
- onHttp
- onEnabledChange
- onConnectivityChange
- onPowerSaveChange
- onNotificationAction
- onAuthorization
Example
BackgroundGeolocation.removeListeners();
Implementation
static Future<bool> removeListeners() async {
await Future.wait(_subscriptions.map((sub) => sub.subscription.cancel()));
_subscriptions.clear();
return true;
}