question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error catching my location google maps cordova

See original GitHub issue

I’m submitting a … (check one with “x”)

  • question
  • any problem or bug report
  • feature request

If you choose ‘problem or bug report’, please select OS: (check one with “x”)

  • Android
  • iOS

cordova information: (run $> cordova plugin list)

com.googlemaps.ios 2.6.0 "Google Maps SDK for iOS"
com.telerik.plugins.nativepagetransitions 0.6.5 "Native Page Transitions"
cordova-plugin-add-swift-support 1.7.1 "AddSwiftSupport"
cordova-plugin-background-mode 0.7.2 "BackgroundMode"
cordova-plugin-console 1.1.0 "Console"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-device-orientation 2.0.1 "Device Orientation"
cordova-plugin-email-composer 0.8.15 "EmailComposer"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-geolocation 4.0.1 "Geolocation"
cordova-plugin-googlemaps 2.2.9 "cordova-plugin-googlemaps"
cordova-plugin-nativegeocoder 2.0.5 "NativeGeocoder"
cordova-plugin-network-information 2.0.1 "Network Information"
cordova-plugin-request-location-accuracy 2.2.2 "Request Location Accuracy"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-plugin-x-socialsharing 5.4.0 "SocialSharing"
cordova-sqlite-storage 2.3.1 "Cordova sqlite storage plugin"
cordova.plugins.diagnostic 3.9.2 "Diagnostic"
es6-promise-plugin 4.2.2 "Promise"
ionic-plugin-keyboard 2.2.1 "Keyboard"
onesignal-cordova-plugin 2.3.3 "OneSignal Push Notifications"

Current behavior: captura de tela 2018-05-09 as 16 42 29

image-1

When I enter all the code performs perfectly, however at the time of picking up my location I face this image problem up.

Expected behavior: I expect to be able to take my position and plot on the map natively.

Related code, data or error log (please format your code or data):

  loadMap() {
    // Get the map configuration information in the environment
    let mapOptions: GoogleMapOptions = environment.googleMaps.map.options;

     // This variable and declare before starting the map to be able to insert in the html the #id map and to have where to insert the map
    // On the contrary, if this variable is declared after the map creation happens, it fails and the map is not loaded
    this.setHeaderAndMessageWithZone(false, 'map_is_ready');


     // Get the html where the map will be inserted, which was released by the above variable
    let mapElement: HTMLElement = document.getElementById('map');

    // Create map and assign on map variable
    this.map = GoogleMaps.create(mapElement, mapOptions);

     // Listen to the event when the map was ready.
    // When the map is ready, it is necessary to upload information
    this.map.one(GoogleMapsEvent.MAP_READY).then(() => {
      console.log('map iniciado e agora visivel')

      
      // Place Map visible
      this.map_visible = true;

      
       // Get the position where the user is once 
      if (!this.triggerHasPositionUser) {
         // Here I call the function where I should get my location and plot on the map
        this.getMyLocationAndCenterOnMap();
      }

      // Start listening to click events on the map
      this.map.on(GoogleMapsEvent.MAP_CLICK).subscribe(() => {
        this.openPointInformation = false;
        this.timeDistanceBetweenMyAndPoint = null;
        this.timeDistanceBetweenPointAndBus = null;
      });
    });
  }


  // Search for user location and center on the map
  getMyLocationAndCenterOnMap() {
    this.map.getMyLocation().then((resp) => {
      // Center the camera on the user the first time
      this.map.animateCamera({
        target: resp.latLng,
        zoom: 16
      });
      this.ioUserLocationAccessTimeReal(resp.latLng);
      // Disables the trigger to pick up the user's first position.
      this.triggerHasPositionUser = true;
    });
  }

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
renanmoraescommented, May 9, 2018

Ufa ! I saw here that it is declared. But it works for both versions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error using Cordova Google Maps plugin in android emulator
When calling plugin.google.maps.Map.getMap I don't see the map being shown. Remote inspection with Chrome reveals there's an error in the ...
Read more >
cordova-plugin-geolocation
This plugin provides information about the device's location, such as latitude and longitude. ... This requires cordova 5.0+ ( current stable 1.0.0 )....
Read more >
nightstomp/cordova-plugin-googlemaps - Gitter
I'm trying to integrante Googlemaps phonegap plugin on my app I'm using ... of the map when i tap the panel the map...
Read more >
Ionic 5 Complete guide on Geolocation, permission and auto ...
Part 2— Ionic 5 with Angular and Cordova (Pending) ... Note: Enter your own Google maps API key in the component to view...
Read more >
[Google Maps Plugin] The app crach as soon a marker is added
After further analysis, it seems that in a screen with a Map and a Watch (from R&D Location Plugin component) when the watch...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found