JulianAssmann / flutter_background

A flutter plugin to keep apps running in the background via foreground services. Android only.
https://pub.dev/packages/flutter_background
MIT License
86 stars 46 forks source link

Location continuelly #20

Closed gaoyx-tech closed 3 years ago

gaoyx-tech commented 3 years ago

hello,I am a Chinese flutter developer,I used this project for location continuelly,even if screen off or let the app back to background.I use HuaWei Meta20,I found that if screen off after seconds the service will stop,it cannot location again.

JulianAssmann commented 3 years ago

I am not sure how Huawei handles background execution of apps, as every OEM handles it a bit differently. What code are you trying to run where? Do you have any logs that could reveal the issue? I did not test this package with geolocation services, but check out other plugins specifically made for this purpose like flutter_background_geolocation or background_locator.

gaoyx-tech commented 3 years ago

ok,thanks for reply.

JulianAssmann commented 3 years ago

You're welcome. Please feel free to reopen the issue at any time.

alkebuware commented 3 years ago

I was able to fix this problem recently and wanted to post a solution if anyone comes across this issue. In your Flutter app's Android's AndroidManifest.xml tag add the following

<service android:name="de.julianassmann.flutter_background.IsolateHolderService"
                 android:foregroundServiceType="location" />