Skip to content
This repository has been archived by the owner on Jul 9, 2019. It is now read-only.

salahamassi/locate-library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Locate library

What is it?

This library simplified the way to get current location for user (lat,lng) it's based on google location library, with more option like request permissions for android 6 and above.

It easily get your current location by one line !


How to use it?

First Install

Maven

<dependency>
  <groupId>net.salah.locate</groupId>
  <artifactId>locate</artifactId>
  <version>1.0.2</version>
  <type>pom</type>
</dependency>

Gradle

dependencies {
   compile 'net.salah.locate:locate:1.0.2'
}

Second Usage

make your activity or fragment class implements Locate.LocationResult

 class MainActivity extends AppCompatActivity implements Locate.LocationResult 

put this code where you need

  Locate.with(MainActivity.this)
                        .addLocationResultListener(MainActivity.this)
                        .build();

and you get the result in overridden method 'onGetLocationSuccess(double lat, double lng)' or 'onGetLocationFailed(@Nullable String message)'

onGetLocationSuccess

  @Override
    public void onGetLocationSuccess(double lat, double lng) {
        ((TextView)findViewById(R.id.result)).setText(getString(R.string.lat)+" : "+lat+"\n"+getString(R.string.lng)+" : "+lng);
    }

onGetLocationFailed

    @Override
    public void onGetLocationFailed(@Nullable String message) {
        ((TextView)findViewById(R.id.result)).setText(message);
    }

ScreenShot

permission

Locate methods

  • debuggingMode()
    • for tracking and print all operation happened and library in android studio logcat not working to yet 😅
  • setPriority(Priority priority)
    • used to set Priority for LocationRequest based on google location library more here
    • LocationRequest
  • setInterval(long interval)
    • used to set interval for LocationRequest based on google location library for example if you set it "60000" that means that you'll get updates every 60 seconds. more here
    • LocationRequest
  • setFastInterval(long fastInterval)
    • used to set fast interval for LocationRequest based on google location library more here
    • LocationRequest

Developer contact

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages