The locationServicesEnabled() method on LocationState class only checks if the current _"locationmode" 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, _"locationmode" returns '2' when location service is OFF.
Again, samsung lollipop devices return _"locationmode" as '1' when location service is on.
Whereas other devices set _"locationmode" as '3' when location service is on.
Considering all the devices, the locationServicesEnabled() should return the following:
The locationServicesEnabled() method on LocationState class only checks if the current _"locationmode" 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, _"locationmode" returns '2' when location service is OFF. Again, samsung lollipop devices return _"locationmode" as '1' when location service is on. Whereas other devices set _"locationmode" as '3' when location service is on.
Considering all the devices, the locationServicesEnabled() should return the following:
return locationMode %2 != 0;