【发布时间】:2017-07-12 14:33:00
【问题描述】:
我已经在 android studio 中的一项活动中使用 geofire 在 firebase 中插入了位置,现在我想用标记检索单个谷歌地图活动中的所有位置。 我已经创建了地图活动,但我不知道如何从 firebase 检索位置。
请帮助我陷入困境。附带一些源代码。
这是我将位置发送到 firebase 的代码
GeoFire geoFire = new
GeoFire(databaseReference.child("Location").child(user.getUid()));
geoFire.setLocation("location", new
GeoLocation(location.getLatitude(), location.getLongitude()), new
GeoFire.CompletionListener() {
@Override
public void onComplete(String key, DatabaseError error) {
if (error != null) {
Toast.makeText(gpdfuel.this, "There was an error
saving the location to GeoFire: " + error, Toast.LENGTH_LONG).show();
} else {
Toast.makeText(gpdfuel.this, "Location saved on server
successfully!", Toast.LENGTH_LONG).show();
}
}
});
【问题讨论】:
标签: android firebase firebase-realtime-database geofire