microsoft/Bing-Maps-Fleet-Tracker

Android client: Check location settings and advise if GPS is disabled

MartinRobins opened this issue · 3 comments

I recently set up a test environment for this project and all went well except that the Android client would not track trips properly on one device (though it worked perfectly on another), but instead only recognised points where it could connect to Wi-Fi.

I later discovered that the device on which the tracking worked had the location settings set to high accuracy whilst the device that did not work had battery saving selected (i.e. no GPS). Note that the device in question has no SIM installed at the moment either.

The Android Location Manager exposes a "isProviderEnabled" enabled method that allows you to check if GPS is enabled; might I suggest that this be used and where GPS is not enabled the user be prompted to enable it for a better experience (possibly even sending the user to the correct settings page to change it)?

Yes indeed, this is a very good point and looks like a good start to anyone wanting to contribute to the project.

Ionic provides an interface to locate the user even if GPS is disabled.
The location is inferred from network signals such as IP address, RFID, WiFi and Bluetooth MAC addresses, and GSM/CDMA cell IDs.

It will ask the user for GPS permissions and then you can either accept it or deny it. There are callback functions for both so if the GPS permission is not provided you can maybe redirect the user to an instructions page to guide him.

You can check it out here:
https://ionicframework.com/docs/native/geolocation/

This has been implemented in PR #68