Skip to content

MalekKamel/RxGps

Repository files navigation

RxGps

RxJava wrapper for Android LocationSettingsRequest used to enable GPS.

If you tried to enable GPS before, you'll find it a complex task and encounter many problems. One of these problems is ResolvableApiException which you must handle in your onActivityResult(). As a result you'll spread your logic everywhere!

The Clean Solution

Using RxLocationSettingsRequest you just write few lines of code and all the work will be done for you!
LocationRequest locationRequest = new ...
new RxGps()  
        .enable(locationRequest, MainActivity.this) // FragmentActivity
        .subscribe(isLocationRequested -> {  
            if (isLocationRequested){  
                // Location is now enabled and you can implement your logic of  
                // location safely  
              }  
         });

Installation

Download

dependencies {
    implementation 'com.sha.kamel:rx-location-settings-request:1.0.4@aar'
}

allprojects {
 repositories { 
  maven { url "https://dl.bintray.com/shabankamel/android" } 
 }
}

See 'app' module for the full code.

License

Apache license 2.0

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published