Skip to content
/ libGps Public

Simple library for easily accessing location on android

Notifications You must be signed in to change notification settings

afrise/libGps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

libGps

Simple library for easily accessing location on android, written in kotlin

to use:

import java file into project and set package to match your project

add the following to your android-manifest.xml:

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
class mainActivity(){
  Gps mGps = new Gps();
  void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    mGps.init(this);
  }
}  

once initialized, you can call any of the following functions:

mGps.latitude();              //(Double)current latitude 
mGps.longitude();             //(Double)current longitude 
mGps.latLng();                //(latLng)current latitude and longitude in google maps api friendly format 
mGps.accuracy();              //(float)location accuracy in M 
mGps.bearing();               //(float)current bearing in degrees
mGps.speed();                 //(float)current speed in m/s 
mGps.altitude();              //(Double) current altitude in m
mGps.getLocation();           //(Location) returns most recent location in an object
mGps.requestPermission(this); //requests location permission. called automatically during init, but useful 
                              //if you need to ask again after initialization 

init() will ask for permissions for you, although there may be issues if the user says no, then you may have to call requestPermission() in your code again.

About

Simple library for easily accessing location on android

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages