Create a gist now

Instantly share code, notes, and snippets.

angular.module('myapp.services', [])
.service('LocationService', function ($cordovaGeolocation) {
return {
askLocationPermission: function (successCallback, errorCallback) {
var permissions = cordova.plugins.permissions; // could not find a better way to access cordova; it's not in $window
permissions.requestPermission(permissions.ACCESS_COARSE_LOCATION, successCallback, errorCallback);
}
getCoords: function () {
// omitted for brevity
};
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment