Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/malekkamel/rxlocation
RxJava wrapper for Android current location.
https://github.com/malekkamel/rxlocation
android android-library android-sdk google-maps gps location rxjava2
Last synced: about 1 month ago
JSON representation
RxJava wrapper for Android current location.
- Host: GitHub
- URL: https://github.com/malekkamel/rxlocation
- Owner: MalekKamel
- Created: 2018-08-28T21:52:29.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-05-19T15:48:41.000Z (over 3 years ago)
- Last Synced: 2024-10-09T11:04:37.827Z (3 months ago)
- Topics: android, android-library, android-sdk, google-maps, gps, location, rxjava2
- Language: Java
- Size: 289 KB
- Stars: 27
- Watchers: 0
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# RxLocation
### RxJava wrapper for Android location.![alt text](https://github.com/ShabanKamell/RxLocation/blob/master/blob/master/raw/mobile-location.png "Sample App")
# Features
- [ ] Easy-to-use APIs
- [ ] Handle runtime.
- [ ] Enable GPS.#### Gradle:
```groovy
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: [![](https://jitpack.io/v/ShabanKamell/RxLocation.svg)](https://jitpack.io/#ShabanKamell/RxLocation)
)# Usage
```java
new RxLocation()
.retrieveCurrentLocation(MainActivity.this)
.subscribe(location -> {
String msg = "lat = " +
location.getLatitude() +
", lng = " +
location.getLongitude();
tv_location.setText(msg);
}
);
```
## Listen For Location Updates
```java
rxLocation.listenForUpdates(MainActivity.this)...
```
### Update Quality
You can set update quality by passing `UpdateQuality` object to the overloaded `listenForUpdates` function
```java
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