Google maps device locator - how to use it

Im trying to get my long and lat coordinates from my electron. I’m trying to use the google maps device locator library. I’ve followed the following tutorial: https://docs.particle.io/tutorials/integrations/google-maps/#run-the-google-maps-firmware-library-on-your-devices

But I dont get any values. instead i get a 403 error…? I’ve enabled billing. Below is my code and console output:

Nevermind I figured it out. I looked into the error message on the integration output on the console, and learned that I had not enabled apis for the project I had made!

To clarify, this will only work if there is a cellular connection? Is there any way to store the long and lat as a variable? To store in an sd card for example

This works for both Wi-Fi and cellular.

In your locationCallback, you’d add code to save the lat and lon on the device, on an sd card, for example.

1 Like

Sorry Im a noob. How? I want to store the long and lat in the loop

You get the parameters float lat and float lon from the handler just assign them to a global float variable (e.g. x = lon; y = lat;).
Once you have the variables set you can use them in any other function (e.g. loop()) and can do with them whatever you want.

But if that fundamental truth poses a problem, you may need to more basic understanding of coding which isn’t really the scope of this forum.


I’ve also changed the topic title to reflect the new direction of the discussion.