Hook-error with the Google Maps Integration

I’ve followed the instructions in the Console step by step, but my Particle Electron continues to send out the following alert:

hook-error/deviceLocator/0 - error status 404 from www.googleapis.com

The Electron firmware build is 0.6.2, and it’s located in a large metropolitan area in Canada where there should be plenty of cellular coverage. Any help is greatly appreciated.

hmm… Has it ever worked before?

Try pressing the TEST button on the top right of the webhook and see if it’s successful.

Hi, I’m not sure where to find a TEST button…is it in the console, or elswhere? When I go to Events, I see the following error message:

{“data”:“error status 404 from www.googleapis.com”,“ttl”:60,“published_at”:“2017-06-23T16:24:12.581Z”,“coreid”:“particle-internal”,“name”:“hook-error/deviceLocator/0”}

Not sure if you have it. Otherwise, try deleting the integration and add again:

It doesn’t appear I have such a button.

Like i mentioned, delete the integration and create a new one if it’s not available.

I already tried removing and re-creating it twice; but the Test button still doesn’t show up.

Error 404 means that the cellular tower you are closest to is not in the Google Geolocation database. The database is extensive, but doesn’t cover every tower, unfortunately.

Ah, I see! Interesting, as the device is located in a major city in Canada…Is this a common problem? I would expect Google’s database would include most of North America at the least.

If not, is there any other firmware you would recommend to me for locating a device? Even just a longitude/latitude output would already be great. A deviation of a few kilometers would be acceptable, so it doesn’t need to be spot-on.

Either way, thanks a bunch already for all your help! Really appreciate it, have been trying to figure out the issue to this problem for a day now.

It’s my understanding that it’s not that Google obtained a list of every cell tower from every carrier. Instead if enough people with an Android phones with location services enabled happen to grab both a GPS and a cell tower location, it’s added to the database. It appears that the location can be fine-tuned as more data points are added, as well. It’s the same sort of thing that they do with Wi-Fi BSSIDs. Apple does the same thing with iOS devices, in their own Wi-Fi BSSID database.

Ahh I see! Thanks for explaining it to me, much appreciated. I want to use this device in a research project, and the GPS-tracking is important to me to know the approximate location in case the device gets moved by someone/something. Considering getting a signal in a city with 2+ million already is unreliable, I’m hesistant to dispatch the device to less populous areas that probably have even worse coverage.

Hi, I am experiencing a similar problem to above but it doesn’t seem that the cell tower ID is the problem, or maybe I’m misunderstanding how this works?

I followed the same tutorial referenced above and can see the data sent to Google:


I also get the 404 response, not found. However, when I manually use a REST tool (Chrome REST Console) to manually send a query using the same values, it is successful and returns coordinates within a mile of my house:

https://www.googleapis.com/geolocation/v1/geolocate?key=[API KEY]

“cellTowers”: [
“cellId”: 9659994,
“locationAreaCode”: 42976,
“mobileCountryCode”: 310,
“mobileNetworkCode”: 410

“location”: {
“lat”: 47.7901829,
“lng”: -122.1878886
“accuracy”: 1172.0

I have tried using both the “locate” and “google-maps-device-locator” libraries, as well as with the beta Google Maps integration and a custom webhook integration (using rickkas7’s tutorial here).

Any idea why I get a 404 through the library/webhook, yet a manual API call using a REST tool works fine when using the same values?

I also never got the Google Maps Integration to work internationally (e.g. Germany, Austria, …, even in touristy areas where cell towers should be known to Google)

Would be good if Particle could come up with a more generally valid integration - @rickkas7?

I think there might be a bug in the parsing of the operator name string in the device firmware library. That’s the “o” parameter in the JSON and it probably should not be “0041005400260054”. When you did it manually, you left this off.

If you passed “carrier”:“0041005400260054” as an outer JSON key/value it might have an effect.

However, it might have returned a location when you used the REST console because you didn’t add a top level JSON key/value “considerIp”:“false”, and it defaults to true. Thus it might have used IP address geolocation, not the results from the cell tower location. It’s disabled for the official integration, since it would use the IP geolocation of the webhook server, not your location.

So I went back and ran four different tests based on your suggestion. Results are odd. It seems that the “carrier” and “considerIp” key/values have no effect on the results. The only way I can generate a 404 consistently is if I change the value of the “CellId” (I removed the last digit). Is there any chance the Google Maps integration is parsing this value incorrectly or something? Is there a way to see or modify the advanced details of the Google Maps integration similar to a custom webhook?

Here are the four tests I ran, only the fourth one fails:

Make sure there is a billing account associated with the Google App / Service you created. I had the same issue and I found it when I tried to deploy using the cloud command line, and it told me I first need to setup billing

Hello All,

Has anyone had successful resolution to this? My hook is sent but I continually get a hook error.

HTTP/1.1 404 Not Found
Vary: X-Origin
Content-Type: application/json; charset=UTF-8
Date: Wed, 30 Aug 2017 15:51:07 GMT
Expires: Wed, 30 Aug 2017 15:51:07 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Alt-Svc: quic=":443"; ma=2592000; v="39,38,37,35"
Accept-Ranges: none
Vary: Origin,Accept-Encoding
Transfer-Encoding: chunked

{“error”:{“errors”:[{“domain”:“geolocation”,“reason”:“notFound”,“message”:“Not Found”}],“code”:404,“message”:“Not Found”}}

Same issue here. Worked for some time, then started getting 404 and now I can’t seem to get a 200 anymore in several places in Canada. Thought initially it was unknown cell towers, but I just did a test with the data the lib was returning, and google api returns me a location… I guess the webhook is re-encoding the data incorrectly… can’t see any other reason… May write my own webhook in the meantime…

Sorry for the long delay. The most common 404 problem has been resolved! The data in @carfarmer’s report was the key. Based on the Google Geolocation API docs, internally I set “radioType”:“gsm” as it suggested, though the field is optional. It would appear that if you explicitly specify gsm, a bunch of towers can’t be geolocated, especially outside the US. I presume this is because the towers are only tagged lte. The field is no longer specified, and the fix is now live in the cloud and you don’t need to update anything on your device or in the libraries and it should now work much better.

I am still getting 404 almost always, sometimes it works. What can i do ?

after 35 minutes is working, i did not change anything