rekabhq / background_locator

A Flutter plugin for updating location in background.
MIT License
288 stars 327 forks source link

App hangs after awaiting BackgroundLocator.unRegisterLocationUpdate() when background locator is not running #262

Closed Wian-TMC closed 3 years ago

Wian-TMC commented 3 years ago

Call BackgroundLocator.unRegisterLocationUpdate() when the background locator is not running. The reason for this was to combat the issue regarding the unreliable return of BackgroundLocator.isRunning() on iOS. Because of this I always call BackgroundLocator.unRegisterLocationUpdate() to ensure the locator is killed, even if it was not running, but calling BackgroundLocator.unRegisterLocationUpdate() when the service is not running blocks the application because it never returns when awaited for.

When the background service is not running, the response of BackgroundLocator.unRegisterLocationUpdate() outputs Locator service is not running, nothing to stop in the terminal, but fails to return when awaited, and therefore the app just hangs forever waiting for BackgroundLocator.unRegisterLocationUpdate() to resolve.

Simple solution would be to just return the future when this happens.

mehdok commented 3 years ago

Hi @Wian-TMC Thank you for opening an issue;

Fixed in c2b66f9;