// This #include statement was automatically added by the Particle IDE.
#include <google-maps-device-locator.h>
GoogleMapsDeviceLocator locator;
void locationCallback(float lat, float lon, float accuracy);
void setup()
{
Serial.begin(9600);
while (!Serial.available()) delay(100);
Serial.println("Setup - Device Locator");
// Scan for visible networks and publish to the cloud every 60 seconds
// Pass the returned location to be handled by the locationCallback() method
Serial.println("Setup - subscribe with locationCallback");
locator.withSubscribe(locationCallback);
Serial.println("Setup - locator runs every 60 seconds");
//locator.withLocateOnce();
locator.withLocatePeriodic(60);
}
// subscription handler
// Handle the returned location data for the device. This method is passed three arguments:
// - Latitude
// - Longitude
// - Accuracy of estimated location (in meters)
void locationCallback(float lat, float lon, float accuracy)
{
Serial.printlnf("Lat: %f Lon: %f Acc (m): %f", lat, lon, accuracy);
}
void loop()
{
delay(1000);
Serial.println("Loop - locator.loop called every second");
locator.loop();
}
I am trying to track the location of my devices and input them on a map, also what’s the best way to save the location data to analyze and get insights from!