+What steps will reproduce the problem?
Turn on the GPS, start the app, start a new scanning session. After few minutes, turn off the GPS on the device.
What is the expected output? What do you see instead?
When I turn off the GPS, I expect the app stops listening to the GPS updates, since none would be available. However, it does not remove the location listener and unnecessarily drain the battery.
What version are you using? On what operating system?
Latest version on Nexus 5x running Android Marshmallow.
Please provide any additional information below.
When I checked the source code, you only remove the registered location listener in "org.openbmap.services.positioning.providers.GpsProvider.java" inside "disableUpdates()". The method "disableUpdates()" is only called on "start()" and "stop()" methods in the same class. The method "stop()" will be called only if the user closes the scanning session. However, if the user turns off the GPS of the device, this app does not remove the registered location listener and keeps listening for updates, which is not available since the GPS is off.
My suggestion to fix the issue is to call the method "disableUpdates()" in the callback "onProviderDisabled" and call "enableUpdates" in the callback "onProviderEnabled" to avoid consuming power unnecessarily.
+What steps will reproduce the problem? Turn on the GPS, start the app, start a new scanning session. After few minutes, turn off the GPS on the device.
What is the expected output? What do you see instead? When I turn off the GPS, I expect the app stops listening to the GPS updates, since none would be available. However, it does not remove the location listener and unnecessarily drain the battery.
What version are you using? On what operating system? Latest version on Nexus 5x running Android Marshmallow.
Please provide any additional information below. When I checked the source code, you only remove the registered location listener in "org.openbmap.services.positioning.providers.GpsProvider.java" inside "disableUpdates()". The method "disableUpdates()" is only called on "start()" and "stop()" methods in the same class. The method "stop()" will be called only if the user closes the scanning session. However, if the user turns off the GPS of the device, this app does not remove the registered location listener and keeps listening for updates, which is not available since the GPS is off.
My suggestion to fix the issue is to call the method "disableUpdates()" in the callback "onProviderDisabled" and call "enableUpdates" in the callback "onProviderEnabled" to avoid consuming power unnecessarily.