smart-location-lib icon indicating copy to clipboard operation
smart-location-lib copied to clipboard

Location Service enable settings does not work on some of Huawei and Mi devices

Open sabid-habib opened this issue 6 years ago • 0 comments

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;

sabid-habib avatar Sep 03 '18 05:09 sabid-habib