All Projects → Zellius → Rxlocationmanager

Zellius / Rxlocationmanager

Licence: mit
RxJava wrap around standard Android LocationManager without Google Play Services

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Rxlocationmanager

Rxgps
Finding current location cannot be easier on Android !
Stars: ✭ 307 (+166.96%)
Mutual labels:  rxjava, location
RxLocation
Use with rxjava,No memory leak,Simple
Stars: ✭ 52 (-54.78%)
Mutual labels:  rxjava, location
Apiclient
A easy to use api client that combines the power of Retrofit, Realm, Gson, Rxjava and Retrolambda in a easy to use library for Java and Android
Stars: ✭ 100 (-13.04%)
Mutual labels:  rxjava
Android Architecture
🌇该项目结合 MVP 与 Clean 架构思想,探索在 Android 项目上的最佳实践。
Stars: ✭ 112 (-2.61%)
Mutual labels:  rxjava
Rxjava
RxJava – Reactive Extensions for the JVM – a library for composing asynchronous and event-based programs using observable sequences for the Java VM.
Stars: ✭ 45,607 (+39558.26%)
Mutual labels:  rxjava
Reactiveandroid
🚀 Simple and powerful ORM for Android
Stars: ✭ 102 (-11.3%)
Mutual labels:  rxjava
Ghost
微影,一款纯粹的在线视频App,基于Material Design + MVP + RxJava + Retrofit + Realm + Glide
Stars: ✭ 1,464 (+1173.04%)
Mutual labels:  rxjava
Mvpframes
整合大量主流开源项目并且可高度配置化的 Android MVP 快速集成框架,支持 AndroidX
Stars: ✭ 100 (-13.04%)
Mutual labels:  rxjava
Mvvm Architecture
The practice of MVVM + Jetpack architecture in Android.
Stars: ✭ 1,634 (+1320.87%)
Mutual labels:  rxjava
Bblocationmanager
A Location Manager for easily implementing location services & geofencing in iOS. Ready for iOS 11.
Stars: ✭ 107 (-6.96%)
Mutual labels:  location
Voice
Minimalistic audiobook player
Stars: ✭ 1,559 (+1255.65%)
Mutual labels:  rxjava
Rxdrive
RxJava wrapper for Google Drive Android API
Stars: ✭ 106 (-7.83%)
Mutual labels:  rxjava
Cateye
高仿猫眼电影App
Stars: ✭ 102 (-11.3%)
Mutual labels:  rxjava
Novate
A safety client by Https for android, (Android网络框架,基于Retrofit和RxJava打造的链式网络库, 支持okhttp的调用风格,又兼容Retrofit API,并支持rxJava链式操作)
Stars: ✭ 1,442 (+1153.91%)
Mutual labels:  rxjava
Basemvp Master
一个基本的MVP应用框架(RxJava+Retrofit+Glide+IjkPlayer),封装比较完善,易于使用,帮助日常快速开发一个项目。
Stars: ✭ 101 (-12.17%)
Mutual labels:  rxjava
Iron
Fast and easy to use NoSQL data storage with RxJava support
Stars: ✭ 112 (-2.61%)
Mutual labels:  rxjava
Android Easylocation
Google play service - location services wrapper
Stars: ✭ 100 (-13.04%)
Mutual labels:  location
Mvvm Reddit
A companion project for our blog post on better Android software development using MVVM with RxJava.
Stars: ✭ 106 (-7.83%)
Mutual labels:  rxjava
Whereami
A short shell script that returns you your IPv4 address and its geolocation.
Stars: ✭ 108 (-6.09%)
Mutual labels:  location
Unidirectional Architecture On Mobile
Dive into 📱 Unidirectional Architecture!
Stars: ✭ 115 (+0%)
Mutual labels:  rxjava

RxLocationManager

Android Arsenal Build Status Coverage Status Android Version

Android library that helps to get location using standart LocationManager, RxJava (1 and 2) and Kotlin. It does not use the Google Play Services and it's easier to use.

Features

  • The library have rxJava and rxJava2 implementations. It is writen in Kotlin, so you can use it in your projects with full language support.
  • Get last known device location from any location provider. You can specify how old Location can be. For example you want only those locations that have been received up to 30 minutes ago.
  • Request current device location. You can specify how long the request will continue. After that Observable will be unsubscribed automatically.
  • You can use LocationRequestBuilder to build sequence of location requests.
  • All methods will return an rxJava objects (Single, Maybe, etc.), so you can perform transofrm/map... etc methods on it.
  • No need to check is Google Play Services valid or installed on device.

Samples

Both rxJava and rxJava2 implementations have same interface but have some differences (like rxJava2 implementation can't emil null value).

If you want to know how to use it on Java/Kotlin Android project with rxJava/rxJava2 support, please look at any sample projects.

Get last known location

rxJava1:
  • Single;
  • It will emit null if there is no last location;
  • It can emit ElderLocationException if location is too old.
rxJava2:
  • Maybe;
  • It will not emit any value if there is no last location;
  • It can emit ElderLocationException if location is too old.
/**
* Get last known location from network provider (You can set any other).
* It will emit only those locations that have been received up to hour ago
*/
final RxLocationManager rxLocationManager = new RxLocationManager(this);
rxLocationManager.getLastLocation(LocationManager.NETWORK_PROVIDER, LocationTime.OneHour()).subscribe();

Request location

rxJava1:
rxJava2:
/**
*Request current location with timeout. 
*It can emit ProviderDisabledException in case of timeout.
*/
final RxLocationManager rxLocationManager = new RxLocationManager(this);
rxLocationManager.requestLocation(LocationManager.NETWORK_PROVIDER, new LocationTime(10, TimeUnit.SECONDS)).subscribe();

LocationRequestBuilder

rxJava1:
  • Single
  • It will emit null if a result is empty and the defaultLocations is null too.
rxJava2:
  • Maybe;
  • It will not emit any value if a result is empty and the defaultLocations is null.
/**
* 1. Try to get valid last known location
* 2. If last known location is not valid, try to get current location from GPS
* 3. Emit a default location if no location was emitted.
*/
final LocationRequestBuilder locationRequestBuilder = new LocationRequestBuilder(this);
locationRequestBuilder.addLastLocation(LocationManager.NETWORK_PROVIDER, new LocationTime(30, TimeUnit.SECONDS), false)
                .addRequestLocation(LocationManager.GPS_PROVIDER, new LocationTime(10, TimeUnit.SECONDS))
                .setDefaultLocation(new Location(LocationManager.PASSIVE_PROVIDER))
                .create()
                .subscribe();

Note: By default the LocationRequestBuilder will ignore any library exceptions, but will throw any other. You can use a transformer to change it. The code below will ignore any error.

addLastLocation(LocationManager.NETWORK_PROVIDER, new LocationTime(30, TimeUnit.MINUTES), new IgnoreErrorTransformer(null))

Download

rxJava1

Download

Maven:
<dependency>
  <groupId>com.github.zellius</groupId>
  <artifactId>rxlocationmanager</artifactId>
  <version>x.y.z</version>
</dependency>
Gradle:
compile 'com.github.zellius:rxlocationmanager:x.y.z'
rxJava2

Download

Maven:
<dependency>
  <groupId>com.github.zellius</groupId>
  <artifactId>rxlocationmanager-rxjava2</artifactId>
  <version>x.y.z</version>
</dependency>
Gradle:
compile 'com.github.zellius:rxlocationmanager-rxjava2:x.y.z'

Setup

Add the necessary permissions to your app manifest.xml.

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

License

The MIT License (MIT)

Copyright (c) 2017 Sergey Solodovnikov

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].