cordova-plugin-gps

0.2.2 • Public • Published

Cordova Plugin Gps

This plugin allows to turn on the gps if that is disabled. If gps is disabled it will show a dialog: by press OK button the app will be able to turn on the GPS.

Platform Available

Only Android

Installation

Install it with npm.

npm i cordova-plugin-gps

How To Use

Simple Use

Call enableGps method in your js.

 
    // Example of Use
    cordova.plugins.cordovaplugingps.enableGps(function(enabled){
        // User can press ok or not
        if (enabled) {
            alert("Gps enabled!");
        } else {
            alert("Gps disabled!");
        }
    }, function(err) {
        alert('An error occurred: ' + err);
    });
 

Force to active / Recursive Request

 
    function requestGpsActivation () {
        // Example of Use
        cordova.plugins.cordovaplugingps.enableGps(function(enabled){
            // User can press ok or not
            if (enabled) {
                alert("Gps enabled!");
            } else {
                requestGpsActivation();
            }
        }, function(err) {
            alert('An error occurred: ' + err);
        });
    }    
 
    requestGpsActivation();
 

Author

Daniele Tulone

Package Sidebar

Install

npm i cordova-plugin-gps

Weekly Downloads

1

Version

0.2.2

License

ISC

Unpacked Size

8.15 kB

Total Files

6

Last publish

Collaborators

  • danieletulonejs