This is only happening I integrate the location plugin in my app. It works fine with the geolocator plugin. If you want to get more description on this issue then visit the stack overflow post where I have mentioned it briefly.
the versions I am using:
Location plugin: 3.2.1
Flutter: 1.22.5
I am not sure whether it is a plugin issue or flutter's issue but when I removed the location plugin. To my surprise, it removed that background location and foreground service permissions from the build.
If You need more information let me know I will provide as much as I can. Thanks.
This is basically beacuse of the added support for location to be used in background. Quick check revealed that Geolocator doesn't have background location support so it doesn't require such permissions.
It will be a problem for those who want to use your plugin for only foreground purposes, not in the background then they have to provide the information on play store like me that we are not using the location data in the background and still they rejected my app and suggested that to remove all unused permissions which are not necessary and used in app.
is there any solution for this scenario other than using the geolocator plugin?
That is a valid point.
I think a solution to remove the hardcoded permissions from the plugin AndroidManifest.xml and adding a piece of documentation that you need to update your apps AndroidManifest.xml in order to use background mode could do the trick.
There is also the case of handling errors because of permissions not being added to the app and user trying to use the background mode. This needs verification for graceful handling. Other case is to rely that on the developer to know to add them and allow the app to fail (or crash).
So I think it's doable and should be done in the first place to be honest.
Yes, It would be great if you can deliver it as soon as possible before more people face the problem.
checkout the solution in #471 to adddress the issue immediately.
Fixed in https://github.com/Lyokone/flutterlocation/pull/475, should be out soon.
Thanks
Most helpful comment
Fixed in https://github.com/Lyokone/flutterlocation/pull/475, should be out soon.