SkillAgentSearch skills...

RxLocation

RxJava wrapper for Android current location.

Install / Use

/learn @MalekKamel/RxLocation
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

RxLocation

RxJava wrapper for Android location.

alt text

Features

  • [ ] Easy-to-use APIs
  • [ ] Handle runtime.
  • [ ] Enable GPS.

Gradle:

allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}

dependencies {
        implementation 'com.github.ShabanKamell:RxLocation:x.y.z'
}

(Please replace x, y and z with the latest version numbers: )

Usage

 new RxLocation()
                .retrieveCurrentLocation(MainActivity.this)
                .subscribe(location -> {
                            String msg = "lat = " +
                                    location.getLatitude() +
                                    ", lng = " +
                                    location.getLongitude();
                            tv_location.setText(msg);
                        }
                );

Listen For Location Updates

     rxLocation.listenForUpdates(MainActivity.this)...

Update Quality

You can set update quality by passing UpdateQuality object to the overloaded listenForUpdates function

rxLocation.listenForUpdates(  
        MainActivity.this,  
        new UpdateQuality()  
                .priority(LocationRequest.PRIORITY_HIGH_ACCURACY)  
                .interval(10 * 1000)  
                .fastestUpdateInterval(2 * 1000))

Note

Call RxLocation.removeLocationUpdates() to stop location updates when you don't need updates anymore.

Update Quality Defaults

  • [ ] priority default value = 0.
  • [ ] interval default value = LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY.
  • [ ] fastestUpdateInterval default value = 2 * 1000.

See 'app' module for the full code.

License

Apache license 2.0

View on GitHub
GitHub Stars27
CategoryDevelopment
Updated4y ago
Forks5

Languages

Java

Security Score

65/100

Audited on May 30, 2021

No findings