Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cordova plugin add cordova-plugin-geolocation
- cordova plugin add cordova-plugin-whitelist
- <!-- cordova script (this will be a 404 during development) -->
- <script src="js/ng-cordova.min.js"></script>
- <script src="cordova.js"></script>
- angular.module('starter', ['ionic', 'ngCordova', 'firebase', 'starter.controllers', 'starter.configs', ])
- .run(function($ionicPlatform, $timeout) {
- $ionicPlatform.ready(function() {
- console.log('Platform ready!');
- if(window.StatusBar) {
- // org.apache.cordova.statusbar required
- StatusBar.styleDefault();
- }
- });
- })
- $ionicPlatform.ready(function() {
- $ionicLoading.show({
- template: '<ion-spinner icon="bubbles"></ion-spinner><br/>Acquiring location!'
- });
- var posOptions = {
- enableHighAccuracy: true,
- timeout: 20000,
- maximumAge: 0
- };
- $cordovaGeolocation.getCurrentPosition(posOptions).then(function (position) {
- var lat = position.coords.latitude;
- var long = position.coords.longitude;
- var myLatlng = new google.maps.LatLng(lat, long);
- var mapOptions = {
- center: myLatlng,
- zoom: 16,
- mapTypeId: google.maps.MapTypeId.ROADMAP
- };
- var map = new google.maps.Map(document.getElementById("map"), mapOptions);
- $scope.map = map;
- $ionicLoading.hide();
- }, function(err) {
- $ionicLoading.hide();
- console.log(err);
- });
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement