我正在android studio中进行地图活动。不触发GeoQueryEventListner的替代功能OnKeyEntered。仅显示吐司“ N1”。代码如下:
private void getNearestWorker() {
DatabaseReference workerLocation = FirebaseDatabase.getInstance().getReference().child("AvailableWorkers").child("mainProblem").child("subProblem");
GeoFire geoFire1 = new GeoFire(workerLocation);
geoQuery = geoFire1.queryAtLocation(new GeoLocation(pickupLocation.latitude, pickupLocation.longitude), radius);
Toast.makeText(this, "N1", Toast.LENGTH_SHORT).show();
GeoQueryEventListener geoQueryEvent = new GeoQueryEventListener() {
@Override
public void onKeyEntered(String key, GeoLocation location) {
Toast.makeText(FindHenchman.this, "N2", Toast.LENGTH_SHORT).show();
if (!workerFound && RequestBol) {
workerFound = true;
FoundWorkerID = key;
Toast.makeText(FindHenchman.this, "N3", Toast.LENGTH_SHORT).show();
DatabaseReference workerRef = FirebaseDatabase.getInstance().getReference().child("Workers").child("mainProblem").child("subProblem").child(FoundWorkerID);
String CustomerID = FirebaseAuth.getInstance().getCurrentUser().getUid();
Toast.makeText(FindHenchman.this, "N4", Toast.LENGTH_SHORT).show();
HashMap map = new HashMap();
map.put("CustomerWorkID", CustomerID);
Toast.makeText(FindHenchman.this, "N5", Toast.LENGTH_SHORT).show();
workerRef.updateChildren(map);
Toast.makeText(FindHenchman.this, "N6", Toast.LENGTH_SHORT).show();
SaveProblem();
}
}