locationCallback not working?

I have an Electron, updated the firmware, implemented and tested the Google Maps API integration.
Now I’m using the sample code (and added a serial print output).

#include <google-maps-device-locator.h>
SerialLogHandler logHandler; 
GoogleMapsDeviceLocator locator;

void setup() {
  Serial.begin(9600);
  // Scan for visible networks and publish to the cloud every 30 seconds
  // Pass the returned location to be handled by the locationCallback() method
  locator.withSubscribe(locationCallback).withLocatePeriodic(30);
}

void locationCallback(float lat, float lon, float accuracy) {
  // Handle the returned location data for the device. This method is passed three arguments:
  // - Latitude
  // - Longitude
  // - Accuracy of estimated location (in meters)
    String Coordinates;
    Coordinates = String::format("{\"lat\":%f,\"lon\":%f,\"accuracy\":%d}", lat, lon, accuracy);
    
    Serial.print("Sending Coordinates : "); 
    Serial.println(Coordinates);


}

void loop() {
  locator.loop();
}

However, I can’t see the Coordinates:

publishLocation
scanData={"c":{"o":"O2 - DE","a":[{"i":145105418,"l":40214,"c":262,"n":3}]}}
0000048129 [comm.protocol] INFO: rcv'd message type=13
publishLocation
scanData={"c":{"o":"O2 - DE","a":[{"i":145105418,"l":40214,"c":262,"n":3}]}}
0000082545 [comm.protocol] INFO: rcv'd message type=13
publishLocation
scanData={"c":{"o":"O2 - DE","a":[{"i":145105418,"l":40214,"c":262,"n":3}]}}
0000105289 [comm.protocol] INFO: rcv'd message type=13

What is displayed in the Events tab in the console? If the webhook is generating 404 errors, then the tower is not known by Google and the callback won’t be called.

1 Like

There are deviceLocator events displayed every 30 secs with the same data as in the serial monitor.

More log data:
0042141378 [app] INFO: unknown key=Ci value=ffff
0042141378 [app] INFO: unknown key=Bsic value=ff

Are you viewing the event logs in the top level of the console, in the Events tab? If you are not seeing any other events, check the Integrations tab, and view inside the Google Maps integration and make sure it’s being triggered and not creating errors. It sounds like your maps integration isn’t working.

For some reason the Google Maps integration that I tested yesterday vanished. Today I re-recreated it and it’s working now.