Gps Detector - Android Library
When GPS disabled shows a dialog and on accept enable it without a need to open android settings
Installation
- Add the dependency from jCenter to your app's (not project) build.gradle file:
repositories {
jcenter()
}
dependencies {
compile 'net.alexandroid.utils:gps:1.6'
}
If you experiencing version conflicts with play services libraries use exclude as shown below:
compile ('net.alexandroid.utils:gps:1.6') {
exclude group: 'com.google.android.gms', module: 'play-services-location'
exclude group: 'com.google.android.gms', module: 'play-services-gcm'
}
How to use it
- Implement GpsStatusDetectorCallBack interface and it methods
public class MainActivity extends AppCompatActivity
implements GpsStatusDetector.GpsStatusDetectorCallBack {
If boolean is true gps is enabled and vice versa.
@Override
public void onGpsSettingStatus(boolean enabled) {
// Your code
}