Fixing CB-1462, there's a difference betwene Global and Local listeners:

This commit is contained in:
Joe Bowser 2012-09-18 14:24:48 -07:00
parent 73abb20b3d
commit 772aedc263
2 changed files with 20 additions and 0 deletions

View File

@ -55,6 +55,11 @@ public class CordovaLocationListener implements LocationListener {
{
this.owner.fail(code, message, callbackId);
}
if(this.owner.isGlobalListener(this))
{
Log.d(TAG, "Stopping global listener");
this.stop();
}
this.callbacks.clear();
Iterator it = this.watches.entrySet().iterator();
@ -69,6 +74,11 @@ public class CordovaLocationListener implements LocationListener {
{
this.owner.win(loc, callbackId);
}
if(this.owner.isGlobalListener(this))
{
Log.d(TAG, "Stopping global listener");
this.stop();
}
this.callbacks.clear();
Iterator it = this.watches.entrySet().iterator();

View File

@ -191,4 +191,14 @@ public class GeoBroker extends Plugin {
this.error(result, callbackId);
}
public boolean isGlobalListener(CordovaLocationListener listener)
{
if (gpsListener != null && networkListener != null)
{
return gpsListener.equals(listener) || networkListener.equals(listener);
}
else
return false;
}
}