All Projects → jaisonfdo → Locationhelper

jaisonfdo / Locationhelper

Android library project that helps you to track user location and manage the updates.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Locationhelper

Leku
🌍 Map location picker component for Android. Based on Google Maps. An alternative to Google Place Picker.
Stars: ✭ 612 (+674.68%)
Mutual labels:  library, location
Easydeviceinfo
📱 [Android Library] Get device information in a super easy way.
Stars: ✭ 1,698 (+2049.37%)
Mutual labels:  library, location
Mapdrawingtools
this library Drawing polygon, polyline and points in Google Map and return coordinates to your App
Stars: ✭ 122 (+54.43%)
Mutual labels:  library, location
React Native Geolocation
Geolocation APIs for React Native
Stars: ✭ 640 (+710.13%)
Mutual labels:  library, location
Neuralpy
NeuralPy: A Keras like deep learning library works on top of PyTorch
Stars: ✭ 77 (-2.53%)
Mutual labels:  library
Mailchimp Api Php
PHP library for v3 of the MailChimp API.
Stars: ✭ 75 (-5.06%)
Mutual labels:  library
React Hook Mighty Mouse
🐭 React hook that tracks mouse events on selected element - zero dependencies
Stars: ✭ 75 (-5.06%)
Mutual labels:  location
C Ares
A C library for asynchronous DNS requests
Stars: ✭ 1,193 (+1410.13%)
Mutual labels:  library
Vokaturiandroid
Emotion recognition by speech in android.
Stars: ✭ 79 (+0%)
Mutual labels:  library
Graphql client
GraphQL Client.
Stars: ✭ 78 (-1.27%)
Mutual labels:  library
Kit
Tools for developing, documenting, and testing React component libraries
Stars: ✭ 1,201 (+1420.25%)
Mutual labels:  library
P5.geolocation
a geolocation and geofencing library for p5.js
Stars: ✭ 75 (-5.06%)
Mutual labels:  location
Cat
Plain C library for parsing AT commands for use in host devices.
Stars: ✭ 77 (-2.53%)
Mutual labels:  library
Php Library Starter Kit
A tool to quickly set up the base files of a PHP library project.
Stars: ✭ 75 (-5.06%)
Mutual labels:  library
Photoviewslider
📷 A simple photo browser for Android applications.
Stars: ✭ 78 (-1.27%)
Mutual labels:  library
Bottombar
(Deprecated) A custom view component that mimics the new Material Design Bottom Navigation pattern.
Stars: ✭ 8,459 (+10607.59%)
Mutual labels:  library
Shotwatch
Android Screenshot Watcher (Screenshot Detection)
Stars: ✭ 76 (-3.8%)
Mutual labels:  library
Gitlink
Git integration for the Wolfram Language
Stars: ✭ 77 (-2.53%)
Mutual labels:  library
Instascrape
🚀 A fast and lightweight utility and Python library for downloading posts, stories, and highlights from Instagram.
Stars: ✭ 76 (-3.8%)
Mutual labels:  library
Kbcsv
KBCsv is an efficient, easy to use .NET parsing and writing library for the CSV (comma-separated values) format.
Stars: ✭ 75 (-5.06%)
Mutual labels:  library

LocationHelper

This is a sample Android application to show how to track user's location and manage the updates

ScreenShot

Getting current location through FusedLocationAPI provided by Google is a bit tricky to implement, but the below step-by-step guidelines will explain the procedure.

  1. First, you need to add the needed dependency in your build.gradle file.
     compile 'com.google.android.gms:play-services-location:10.+’
  1. Then add the following permissions into the AndroidManifest.xml file.
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
  1. Next is permission check, From Android 6.0 user can deny the permission request, so before try to get the location we need to check the status of the location access. For this use PermissionUtil class.

  2. For making a connection with Location API, need to create an instance of GoogleApiCLient.

    GoogleApiClient mGoogleApiClient;

    mGoogleApiClient = new GoogleApiClient.Builder(this)
                           .addConnectionCallbacks(this)
                           .addOnConnectionFailedListener(this)
                           .addApi(LocationServices.API).build();

    mGoogleApiClient.connect();
  1. At next implement the OnConnectionFailedListener and ConnectionCallbacks for managing the GoogleApiclient connection.
    public class MyLocationUsingLocationAPI extends AppCompatActivity implements ConnectionCallbacks,
    OnConnectionFailedListener,OnRequestPermissionsResultCallback,                  
    {

      @Override
      public void onConnectionFailed(ConnectionResult result) {
         Log.i(TAG, "Connection failed: ConnectionResult.getErrorCode() = "+ result.getErrorCode());
      }

      @Override
      public void onConnected(Bundle arg0) {
        // Once connected with google api, get the location
      }

      @Override
      public void onConnectionSuspended(int arg0) {
          mGoogleApiClient.connect();
      }
    }
  1. For refreshing the location of the device at regular intervals, use LocationRequest objects.
    LocationRequest mLocationRequest = new LocationRequest();
    mLocationRequest.setInterval(10000);
    mLocationRequest.setFastestInterval(5000);
    mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);

    LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder()
                                              .addLocationRequest(mLocationRequest);
  1. Then check the google play service availability, if available get the last known location of the user's device from the Location service as follows.
     mLastLocation = LocationServices.FusedLocationApi
                        .getLastLocation(mGoogleApiClient);
  1. Using the Geocoder class you can get the address from the above location.
     public Address getAddress(double latitude,double longitude)
     {
         Geocoder geocoder;
         List  addresses;
         geocoder = new Geocoder(this, Locale.getDefault());

         try 
         {
             // Here 1 represent max location result to returned, by documents it recommended 1 to 5
             addresses = geocoder.getFromLocation(latitude,longitude, 1); 
             return addresses.get(0);
          } catch (IOException e) {
             e.printStackTrace();
          }
        return null;
      }
 

For more information, check out my detailed guide here : http://droidmentor.com/get-the-current-location-in-android/

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