android-location-provider

1.0.1 • Public • Published

Android Location Provider for Cordova r1.0.0

Android Location Provider is a cordova plugin allow users to interact with native android location services, through google play services location provider 15.0.1.

It's easy to use:

Using with cordova:

    Location.Provider.< featuer >(args[], callback_handler, error_handler);
    callback_handler = function(args){
        //your code goes here
    }
    error_handler = function(){
        //your error handler goes here
    }

Using with ionic:

    (<any>window).Location.Provider.< featuer >(args[], callback_handler, error_handler);
    function callback_handler(callback_args){
        //your code goes here
    }
    function error_handler {
        //your error handler goes here
    }

Features:

Get the most known location of device

    getLastKnownLocation(onLocationResult, onError);
 
    onLocationResult = function(location){
        // This function return json object with latitude and longitude
        var latitude = location.latitude;
        var longitude = location.longitude;
        //your code goes here
    }
    onError = function(){
        //your error handler goes here
    }

Watching for location updates

    getLocationUpdate(updateInterval, fastestUpdateInterval, onLocationUpdate, onError);
    onLocationUpdate = function(location){
        // This function return json object with latitude and longitude
        var latitude = location.latitude;
        var longitude = location.longitude;
    }
    onError = function(){
        //your error handler goes here
    }

Get formated adderss as string

    getLocationAddress(latitude, longitude, onAddressFound, onError);
    onAddressFound = function(address){
        // address is a string with most accurate address found by geocoder
 
    }
    onError = function(){
        //your error handler goes here
    }

How to install

    cordova plugin add android-location-provider

Package Sidebar

Install

npm i android-location-provider

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

57.8 kB

Total Files

12

Last publish

Collaborators

  • mohamedismail77