Google Geolocation API issues

electron
Tags: #<Tag:0x00007f1ca5ff5ed8>

#1

I know this has been covered a number of times, however, it was working as recently as a month ago and we have developed this software for geolocation and now it is no longer functioning.

I have a valid and paid Google API subscription.

I created an integration at the device level that is talking to google and receiving the correct data.

{
  "name": "deviceLocator",
  "data": "{\"c\":{\"o\":\"T-Mobile\",\"a\":[{\"i\":21132,\"l\":8104,\"c\":310,\"n\":260}]}}",
  "ttl": 60,
  "published_at": "2019-05-14T18:54:35.564Z",
  "coreid": "420030001550483553353620"
}
POST /geolocation/v1/geolocate?key=AIza.....................................................
 HTTP/1.1
User-Agent: ParticleBot/1.1 (https://docs.particle.io/tutorials/integrations/google-maps/)
host: www.googleapis.com
accept: application/json
content-type: application/json
content-length: 145
Connection: keep-alive

And the response:

HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: Mon, 01 Jan 1990 00:00:00 GMT
Date: Tue, 14 May 2019 18:54:35 GMT
Vary: X-Origin
Content-Type: application/json; charset=UTF-8
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Alt-Svc: quic=":443"; ma=2592000; v="46,44,43,39"
Accept-Ranges: none
Vary: Origin,Accept-Encoding
Transfer-Encoding: chunked

{"location":{"lat":39.5547152,"lng":-84.2308303},"accuracy":2406}

I am getting a vaild hook-response in the devices events…

hook-response/deviceLocator/420030001550483553353620/0
39.5547152,-84.2308303,2406

here are the important bits of my program:

#include <google-maps-device-locator.h>
...
String strLong;
String strLat;
String strAcc;
String locationInfo;
...
GoogleMapsDeviceLocator locator;

void locationCallback(float lat, float lng, float accuracy) {
      
    strLat = String(lat);
    strLong = String(lng);
    strAcc = String(accuracy);

    locationInfo = String(lat)+","+String(lng)+","+String(accuracy);
    
}

void setup() {
...
    Particle.variable("locationInfo", locationInfo);
    locator.withSubscribe(locationCallback).withLocatePeriodic(30); 
...

    Particle.connect();

    delay(1000);
}


void loop() {
    
    locator.loop();

}

As I said, it DID work, but now I only get empty strings from the callback. I have tried formatting things a number of different ways with no change. If I leave the string variables empty, they remain empty and if I preset them to blank or “0”, they remain that way after the callback. its as if the callback is doing nothing at all.

This a Particle Electron and I am currently running 1.2 .0-beta.1 if that matters, but i think it was occuring in 0.8 as well.

Any input would be appreciated!