All Projects → akhgupta → Android Easylocation

akhgupta / Android Easylocation

Licence: apache-2.0
Google play service - location services wrapper

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Android Easylocation

Mybox
Easy tools of document, image, file, network, location, color, and media.
Stars: ✭ 45 (-55%)
Mutual labels:  location
React Hook Mighty Mouse
🐭 React hook that tracks mouse events on selected element - zero dependencies
Stars: ✭ 75 (-25%)
Mutual labels:  location
Leaflet Gps
Simple leaflet control plugin for tracking gps position
Stars: ✭ 90 (-10%)
Mutual labels:  location
Lenz
Console based MAP 🗺 : with lots of features 🤩
Stars: ✭ 51 (-49%)
Mutual labels:  location
Blazerat
🔥 Control your Linux home computer with telegram bot.
Stars: ✭ 60 (-40%)
Mutual labels:  location
Locationhelper
Android library project that helps you to track user location and manage the updates.
Stars: ✭ 79 (-21%)
Mutual labels:  location
Pizza Delivery
university project : Android pizza delivery app
Stars: ✭ 32 (-68%)
Mutual labels:  location
Locokit
Location, motion, and activity recording framework for iOS
Stars: ✭ 1,353 (+1253%)
Mutual labels:  location
Dodo
React Native location sdk based on amap.
Stars: ✭ 72 (-28%)
Mutual labels:  location
Location
Smartphone navigation positionning, fusion GPS and IMU sensors.
Stars: ✭ 87 (-13%)
Mutual labels:  location
Hrcarmarkeranimation
This android library is helpful for google map marker animation with Smooth turn and movement.
Stars: ✭ 52 (-48%)
Mutual labels:  location
Indoorgps
Position Calculating with Trilateration via Bluetooth Beacons(Estimote)
Stars: ✭ 59 (-41%)
Mutual labels:  location
Locationlivedata
A simple LiveData implementation of Android Location API
Stars: ✭ 81 (-19%)
Mutual labels:  location
Teliver Android
Realtime Live Tracking of Location made Easy.
Stars: ✭ 49 (-51%)
Mutual labels:  location
Phpgeo
Simple Yet Powerful Geo Library for PHP
Stars: ✭ 1,306 (+1206%)
Mutual labels:  location
Svelte Pick A Place
Javascript location picker built with Svelte
Stars: ✭ 44 (-56%)
Mutual labels:  location
P5.geolocation
a geolocation and geofencing library for p5.js
Stars: ✭ 75 (-25%)
Mutual labels:  location
Func Loc
A simple tool that helps you to retrieve the function location from its reference.
Stars: ✭ 99 (-1%)
Mutual labels:  location
Whereareyou
Real time location tracker using Android App & Firebase with Mapbox
Stars: ✭ 96 (-4%)
Mutual labels:  location
Geo Location
Web component element for the Geolocation API
Stars: ✭ 86 (-14%)
Mutual labels:  location

Android-EasyLocation

Getting location updates requires lots of bolierplate code in Android, You need to take care of

  • Google Play services availablity Check, Update Google play Service Dialog
  • Creation of GoogleApiClient and its callbacks connected,disconnected etc.
  • Stopping and releasing resources for location updates
  • Handling Location permission scenarios
  • Checking Location services are On or Off
  • Getting lastknown location is not so easy either
  • Fallback to last known location if not getting location after certain duration

Android-EasyLocation does all this stuff in background, so that you can concentrate on your business logic than handling all above

Getting started

In your build.gradle:

com.google.android.gms:play-services-location dependency also needs to be added like this

x.x.x can be replaced with google play service version your app is using versions information available here

 dependencies {
    compile 'com.akhgupta:android-easylocation:1.0.1'
    compile "com.google.android.gms:play-services-location:x.x.x"
 }

Extend your Activity from EasyLocationAppCompatActivity or EasyLocationActivity:

Create location request according to your needs

LocationRequest locationRequest = new LocationRequest()
        .setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY)
        .setInterval(5000)
        .setFastestInterval(5000);

Create EasyLocation request, and set locationRequest created

EasyLocationRequest easyLocationRequest = new EasyLocationRequestBuilder()
        .setLocationRequest(locationRequest)
        .setFallBackToLastLocationTime(3000)
        .build();
}

Request Single location update like this

requestSingleLocationFix(easyLocationRequest);

Or Request Multiple location updates like this

requestLocationUpdates(easyLocationRequest);

You're good to go!, You will get below callbacks now in your activity

    @Override
    public void onLocationPermissionGranted() {
    }

    @Override
    public void onLocationPermissionDenied() {
    }

    @Override
    public void onLocationReceived(Location location) {
    }

    @Override
    public void onLocationProviderEnabled() {
    }

    @Override
    public void onLocationProviderDisabled() {
    }

Additional Options

Specify what messages you want to show to user using EasyLocationRequestBuilder

EasyLocationRequest easyLocationRequest = new EasyLocationRequestBuilder()
.setLocationRequest(locationRequest)
.setLocationPermissionDialogTitle(getString(R.string.location_permission_dialog_title))
.setLocationPermissionDialogMessage(getString(R.string.location_permission_dialog_message))
.setLocationPermissionDialogNegativeButtonText(getString(R.string.not_now))
.setLocationPermissionDialogPositiveButtonText(getString(R.string.yes))
.setLocationSettingsDialogTitle(getString(R.string.location_services_off))
.setLocationSettingsDialogMessage(getString(R.string.open_location_settings))
.setLocationSettingsDialogNegativeButtonText(getString(R.string.not_now))
.setLocationSettingsDialogPositiveButtonText(getString(R.string.yes))
.build();

License

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.
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].