florent37 / RxGps

Finding current location cannot be easier on Android !
Apache License 2.0
300 stars 42 forks source link

Checking the location settings #3

Open MohamedHamada12 opened 6 years ago

MohamedHamada12 commented 6 years ago

How I can check location setting after user give permission ?

yehiahd commented 6 years ago

@MohamedHamada12 You can simply do this by the following two lines : LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { // GPS settings enabled } else { // GPS settings not enabled }

MohamedHamada12 commented 6 years ago

@yehiahd Yes I know we can check using this way , but it should provided by library because Lib considered location setting enabled and try get location.