smart-location-lib
smart-location-lib copied to clipboard
Location Service enable settings does not work on some of Huawei and Mi devices
The locationServicesEnabled() method on LocationState class only checks if the current "location_mode" is 0 or not. It assumes that each device will return '0' when location service is off. But on some of huawei devices(lollipop and marshmallow) and Xiaomi devices, "location_mode" returns '2' when location service is OFF. Again, samsung lollipop devices return "location_mode" as '1' when location service is on. Whereas other devices set "location_mode" as '3' when location service is on.
Considering all the devices, the locationServicesEnabled() should return the following:
return locationMode %2 != 0;