Google Maps device locator once off call


I’ve implemented the google-maps-device-locator library on a Boron LTE.

The device disconnects from the cellular network regularly. The same happens when I force a handshake between the device and the cloud. When the device disconnects in this way, the google maps library triggers the deviceLocator function and posts deviceLocator to the particle Cloud.

I wish to call deviceLocator only once a day. I especially want to prevent the deviceLocator call to happen each time the device reconnects, since this is causing my Google account bill to increase drastically.

Is there a way to implement the google-maps-device-locator library as a once-off call?

Thank you for the help in advance

How have you currently configured your device locator?
If you don’t configure it with a withLocate...() option it should only trigger when explicitly calling for it in your code via scan() or publishLocation().

I do this in setup()


And then have this call back function where latitude and longitude are global variables.

// subscription handler for location service
void locationCallback(float lat, float lon, float accuracy)
    latitude  = lat;
    longitude = lon;
    locateAcc = accuracy;

This is with WiFi rather than Cellular - I also retry from the loop() on a timed basis locator.loop(); in case the device moves WAP or there is no WiFi on startup. This process needs to be adapted to cellular and whether you are expecting your device to move or not after the initial locate. If your device is screwed to a post then saving the initial location fix to eeprom and always reading from eeprom stored parameters will work and save you extra data comms.

@blacklabdon, you may want to look at this:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.