mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-20 23:56:20 +08:00
Fixing CB-1462, there's a difference betwene Global and Local listeners:
This commit is contained in:
parent
73abb20b3d
commit
772aedc263
@ -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();
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user