Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions android/src/main/java/in/appyflow/geofire/GeofirePlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,24 @@ public void onCancelled(DatabaseError databaseError) {

} else if (call.method.equals("queryAtLocation")) {
geoFireArea(Double.parseDouble(call.argument("lat").toString()), Double.parseDouble(call.argument("lng").toString()), result, Double.parseDouble(call.argument("radius").toString()));

} else if (call.method.equals("updateQuery")) {
if(geoQuery != null){
double lat = Double.parseDouble(call.argument("lat").toString());
double lng = Double.parseDouble(call.argument("lng").toString());
double radius = Double.parseDouble(call.argument("radius").toString());

geoQuery.setCenter(new GeoLocation(lat,lng));
geoQuery.setRadius(radius);

result.success(true);
}else{
result.success(false);
}




} else if (call.method.equals("stopListener")) {

if (geoQuery != null) {
Expand Down
10 changes: 10 additions & 0 deletions ios/Classes/SwiftGeofirePlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@ public class SwiftGeofirePlugin: NSObject, FlutterPlugin, FlutterStreamHandler {


}

else if (call.method.elementsEqual("updateQuery")) {
//Update the query with the specified lat/lng and radius without the need to re-start the listner.
let lat = arguements!["lat"] as! Double
let lng = arguements!["lng"] as! Double
let radius = arguements!["radius"] as! Double
circleQuery?.center = CLLocation(latitude: lat, longitude: lng)
circleQuery?.radius = radius
result(true)
}


if(call.method.elementsEqual("queryAtLocation")){
Expand Down
10 changes: 10 additions & 0 deletions lib/flutter_geofire.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,14 @@ class Geofire {
}
return _queryAtLocation;
}

/*
Update the query with the specified lat/lng and radius without the need to re-start the listner.
*/
static Future<bool?> updateQuery(
double latitude, double longitude, double radius) async {
final bool? isSet = await _channel.invokeMethod('updateQuery',
<String, dynamic>{"lat": latitude, "lng": longitude, "radius": radius});
return isSet;
}
}