0

I read all the docs and some examples of GeoFire for Firebase but I don't understand if it's possibile to get the current location of a user...is it possible? and if it is, how can I get it?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Andrea Culot
  • 114
  • 2
  • 9
  • You should use Core Location to get the user’s location. Then, you use Firebase to store/search it in the database. – Jed Fox Nov 19 '16 at 18:42
  • Your question makes no sense. Firebase is a cloud database system. It doesn't, and shouldn't, have any facility for getting the user's location. That would be like using a popsicle to file your taxes. You want to use the location manager. – Duncan C Nov 19 '16 at 23:02

1 Answers1

0

Geofire has a good readme at github...

Retrieving a location using Swift

geoFire.getLocationForKey("firebase-hq", withCallback: { (location, error) in
  if (error != nil) {
    println("An error occurred getting the location for \"firebase-hq\": \(error.localizedDescription)")
  } else if (location != nil) {
    println("Location for \"firebase-hq\" is [\(location.coordinate.latitude), \(location.coordinate.longitude)]")
  } else {
    println("GeoFire does not contain a location for \"firebase-hq\"")
  }
})

Take a look here and here!

Anfuca
  • 1,329
  • 1
  • 14
  • 27
  • Yes I've already read them but what I understand is that is not possible to get the current location, am I wrong? – Andrea Culot Nov 19 '16 at 18:35
  • you can't get the current location using firebase... you can save it into a database an retrieve it! To get the current location, use things like `CCLocationManager` and those iOS things... – Anfuca Nov 19 '16 at 18:36