Giter Site home page Giter Site logo

florent37 / rxgps Goto Github PK

View Code? Open in Web Editor NEW
301.0 13.0 42.0 168 KB

Finding current location cannot be easier on Android !

License: Apache License 2.0

Java 99.91% Shell 0.09%
android gps location play services rx rxjava rxjava2 reactive geocoding

rxgps's Introduction

RxGps

Finding current location cannot be easier on Android !

- RxJava2 compatible

- Automatically ask for gps runtime permissions

- Check if play services are available for you ;)

Android app on Google Play

Download

Buy Me a Coffee at ko-fi.com

In your module Download

compile 'com.github.florent37:rxgps:(last version)'

Usage

new RxGps(this).locationLowPower()

                .subscribeOn(Schedulers.newThread())
                .observeOn(AndroidSchedulers.mainThread())

                .subscribe(location -> {
                    //you've got the location
                }, throwable -> {
                    if (throwable instanceof RxGps.PermissionException) {
                        //the user does not allow the permission
                    } else if (throwable instanceof RxGps.PlayServicesNotAvailableException) {
                         //the user do not have play services
                    }
                });

GeoCoding

new RxGps(this).lastLocation()

                .flatMapMaybe(rxGps::geocoding)

                .subscribeOn(Schedulers.newThread())
                .observeOn(AndroidSchedulers.mainThread())

                .subscribe(address -> {
                    addressText.setText(getAddressText(address));
                }, throwable -> {
                    if (throwable instanceof RxGps.PermissionException) {
                        //the user does not allow the permission
                    } else if (throwable instanceof RxGps.PlayServicesNotAvailableException) {
                         //the user do not have play services
                    }
                });

Open Source

Forked from patloew RxLocation https://github.com/patloew/RxLocation

And use tbruyelle RxPermission https://github.com/tbruyelle/RxPermissions

Credits

Author: Florent Champigny http://www.florentchampigny.com/

Blog : http://www.tutos-android-france.com/

Fiches Plateau Moto : https://www.fiches-plateau-moto.fr/

Android app on Google Play Follow me on Google+ Follow me on Twitter Follow me on LinkedIn

License

Copyright 2016 florent37, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

rxgps's People

Contributors

acyuta avatar florent37 avatar vjubert avatar volixanov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rxgps's Issues

No way to call this from background

Hi, is there any plans to make this library callable from background with only application context? providing an Activity is not always available when it comes to GPS features.

Location timeout

How to add a timeout in observable of lastlocation() call if it's taking to much time to get location

Propose Logo/icon

Hi @florent37 . I'm graphic designer and an open source enthusiast. I would like to contribute to your awesome project by proposing logo design for it if you allow me. I'll be doing it as a gift for free to your awesome project.
Best regard. Mirza zulfan.

How to stop get location

i have problem to stop get request location, after intent to another activity, request location still live, i have tried

disposable.dispose();

in destroy but not working,
how to solve this

Update location library version request

@florent37 Request update location library version to com.google.android.gms:play-services-location:15.0.1 Because now if add "location" library, will be conflict

Error:
Android dependency 'com.google.android.gms:play-services-location' has different version for the compile (11.8.0) and runtime (15.0.1) classpath. You should manually set the same version via DependencyResolution

Java Compiler and Android error when build the project with RxGps

Hello, I got the error message below

Java Compiler
com.android.builder.dexing.DexArchiveBuilderException: Failed to process /Users/.gradle/caches/transforms-1/files-1.1/rxgps-1.0.2.aar/9ec52c309174054150f40843f57f8146/jars/classes.jar
com.android.builder.dexing.DexArchiveBuilderException: Error while dexing.
com.android.tools.r8.CompilationFailedException: Compilation failed to complete
com.android.tools.r8.utils.AbortException: Error: Invoke-customs are only supported starting with Android O (--min-api 26)

Android Error
Invoke-customs are only supported starting with Android O (--min-api 26)

My culprit is, I use both RxPermission and RxGps altogether.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.