flutter_workmanager icon indicating copy to clipboard operation
flutter_workmanager copied to clipboard

geolocation does not work in workmanger

Open vignesh235 opened this issue 2 years ago • 4 comments

geolocation does not work in workmanger

image

vignesh235 avatar Nov 26 '22 10:11 vignesh235

This is not the correct package

Please use a location package for your requirements.

xunreal75 avatar Nov 26 '22 11:11 xunreal75

@xunreal75 Why we could not use geolocator plugin? It's more popular than location package.

akadatsky avatar Feb 03 '23 14:02 akadatsky

You need background location service. That's not covered with workmananager , not intended and a complete other approach and functionality.

xunreal75 avatar Feb 03 '23 16:02 xunreal75

In callbackDispatcher you need to add:

Workmanager().executeTask((taskName, inputData) async { DartPluginRegistrant.ensureInitialized();

And then you can use Geolocator in this method

oxsidee avatar Feb 05 '23 02:02 oxsidee