2017-02-17 92 views
0
@Override 
    public void onLocationChanged(Location location) { 
     if (location != null) { 
      GeoQuery query = geoFire.queryAtLocation(
       new GeoLocation(location.getLatitude(), location.getLongitude()), 
       DistanceConstants.FILTER_DISTANCE 
     ); 

     query.addGeoQueryEventListener(this); 
     } 
    } 

@Override 
    public void onKeyExited(String key) { 
     Toast.makeText(context, "Key removed", Toast.LENGTH_SHORT).show(); 
    } 

OnKeyEntered()根據我的需要正確執行。結果也是完美的。但是,OnKeyExited()方法永遠不會執行。我有0.2 KM作爲半徑,每當新鑰匙出現在我的0.2公里內時,他們都會被添加,但這些都離開我的興趣領域,他們不會被移除。onKeyExited方法未在GeoFire中執行Android

有什麼特別的原因嗎?

回答

0

我是個白癡。需要使用setCenter()更新我的查詢,並且所有內容都按預期工作。