Storing coordinates of location from the geolocation api in firebase

can anyone tell me how can I store the longitude and latitude in two variables. I am not able to put these coordinates on firebase.
Please help me, Its urgent

#include <google-maps-device-locator.h>

GoogleMapsDeviceLocator locator;

void setup() {
  Serial.begin(9600);
  // Scan for visible networks and publish to the cloud every 30 seconds
  // Pass the returned location to be handled by the locationCallback() method
  locator.withSubscribe(locationCallback).withLocatePeriodic(30);
}

void locationCallback(float lat, float lon, float accuracy) {
  // Handle the returned location data for the device. This method is passed three arguments:
  // - Latitude
  // - Longitude
  // - Accuracy of estimated location (in meters)
}

void loop() {
  locator.loop();
  Serial.print(locator.withSubscribe(locationCallback).withLocatePeriodic(30));
}

What have you tried so far and what isn’t working?

Your question seems very similar to this thread, hence I'll close this one and the discussion should be continued here

1 Like