1.1.2 • Published 7 years ago

cordova-plugin-geolocation-android-activator v1.1.2

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

cordova-plugin-geolocation-android-activator

Simple complement for geolocation plugins, like apache's cordova-plugin-geolocation, that asks the user to give permission to access geolocation and to activate the GPS.

To use

Just call it

If the user allows or have previously allowed the app to access geolocation and GPS was allowed to be activated or was already active, the success callback will be executed. In any other case, the failure callback will.

navigator.geolocation.activator.askActivation(function(response) {
  //Success callback
}, function(response) {
  //Failure callback
});

Response object

The response parameter will always return a object;

{
  "status": 8,
  "message": "GPS activated"
}

All status values can be found in navigator.geolocation.activator.returnStatus for comparison.

If the GPS is not activated and the app has location permission, the user will be asked to accept it's activation, like the images below.

If app doesn't have location permission:

asking-geolocation-permission

Initialy as:

closed GPS activation modal

When "∨" is clicked:

opened GPS activation modal