Skip to content

Instantly share code, notes, and snippets.

@thehungrycoder
Last active September 8, 2016 19:31
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save thehungrycoder/ecab6e4b61565f76245871e7196c74cb to your computer and use it in GitHub Desktop.
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