Locgetter


Source link: https://github.com/titanium-codes/LocGetter

LocGetter

_

Overview

Simple multithread-friendly library for getting latest user locations using RxJava 2.

Install

Gradle

Step 1. Add it in your root build.gradle at the end of repositories:

allprojects {

  repositories {

jcenter()
  
}
 
}
 

Step 2. Add the dependency

For Android studio 3.0

Recommended: This will use all libraries that you defined

dependencies {

  implementation 'com.android.support:appcompat-v7:YOUR_SUPPORT_LIBRARY_VERSION'
  implementation 'com.android.support:design:YOUR_SUPPORT_LIBRARY_VERSION'
  implementation 'io.reactivex.rxjava2:rxandroid:YOUR_RX_ANDROID_VERSION'
  implementation 'io.reactivex.rxjava2:rxjava:YOUR_RX_JAVA_2_VERSION'
  implementation 'com.google.android.gms:play-services-location:YOUR_GOOGLE_PLAY_VERSION'
  implementation ('codes.titanium:locgetter:1.0.3',{

transitive = false
  
}
) 
}
  

Not recommended: This will use all dependencies from library, may increase apk size, increase methods count and lead to compile errors

dependencies {

  implementation 'codes.titanium:locgetter:1.0.3' 
}
 

For Android studio 2.3

Recommended: This will use all libraries that you defined

dependencies {

  compile 'com.android.support:appcompat-v7:YOUR_SUPPORT_LIBRARY_VERSION'
  compile 'com.android.support:design:YOUR_SUPPORT_LIBRARY_VERSION'
  compile 'io.reactivex.rxjava2:rxandroid:YOUR_RX_ANDROID_VERSION'
  compile 'io.reactivex.rxjava2:rxjava:YOUR_RX_JAVA_2_VERSION'
  compile 'com.google.android.gms:play-services-location:YOUR_GOOGLE_PLAY_VERSION'
  compile ('codes.titanium:locgetter:1.0.3',{

transitive = false
  
}
) 
}
 

Not recommended: This will use all dependencies from library, may increase apk size, increase methods count and lead to compile errors

dependencies {

  compile 'codes.titanium:locgetter:1.0.3' 
}
 

Basic Usage

Main features:

  • Getting updates of user locations
  • Getting latest saved user location
  • Getting current user location
  • Catching all errors connects to getting locations

All you need is to create LocationGetter instance using LocationGetterBuilder

 LocationGetter locationGetter = new LocationGetterBuilder(getApplicationContext())

 .build();
 

Optional you can add to builder:

  • LocationRequest to customize location updates
  • GoogleApiClient to use instance of your google api client
  • Logger to get logs of everything happening inside LocationGetter

Start getting locations using one of methods for e.g.

locationGetter.getLatestLocation()

 .observeOn(AndroidSchedulers.mainThread())

 .subscribe(location -> {

  ((TextView) findViewById(R.id.locations_tv)).setText(location.toString());

 
}
, Throwable::printStackTrace);
 

More examples can be found in sample package with sample app.

Helper activity

You can extend your activity from BaseLocationActivity and get access to extended behavior with some features.

  1. Catch exceptions via onLocationError to handle settings and permissions errors
  2. Get callbacks with user locations permission granted/revoked and locations settings granted/revoke
  3. Show dialog on google api available

Release notes

1.0.3

  • Updated Readme
  • Updated dependencies bump

1.0.2

  • Fixed bug with retrolambda crash of onLocationError
  • Added some additional logging

1.0.0

  • Initial release

Resources

Let

Annotation based simple API flavoured with AOP to handle new Android runtime permission model.

Retractable Toolbar - it is an utility library that gives a retractable effect to your toolbar.

This is an Android project allowing to realize a circular ProgressBar in the simplest way possible.

This is an Android project allowing to realize a circular ImageView in the simplest way possible.

Android Web Server (with NanoHTTPD).

Android library that allows a very easy-compatible Shelf View for smartphone and tablet.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes