Commit 8dca2e04 authored by Chris Scott's avatar Chris Scott

Fix race condition requesting activity-updates before google api connected

parent e2dfd2d9
...@@ -114,8 +114,10 @@ public class BackgroundGeolocationPlugin extends CordovaPlugin implements Locati ...@@ -114,8 +114,10 @@ public class BackgroundGeolocationPlugin extends CordovaPlugin implements Locati
if (ACTION_START.equalsIgnoreCase(action) && !isEnabled) { if (ACTION_START.equalsIgnoreCase(action) && !isEnabled) {
result = true; result = true;
isEnabled = true; isEnabled = true;
requestActivityUpdates(); if (googleApiClient.isConnected()) {
requestActivityUpdates();
}
} else if (ACTION_STOP.equalsIgnoreCase(action)) { } else if (ACTION_STOP.equalsIgnoreCase(action)) {
result = true; result = true;
...@@ -447,12 +449,16 @@ public class BackgroundGeolocationPlugin extends CordovaPlugin implements Locati ...@@ -447,12 +449,16 @@ public class BackgroundGeolocationPlugin extends CordovaPlugin implements Locati
public void onConnectionFailed(ConnectionResult arg0) { public void onConnectionFailed(ConnectionResult arg0) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
Log.i(TAG, "- onConnectionFailed");
} }
public void onConnected(Bundle arg0) { public void onConnected(Bundle arg0) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
Log.i(TAG, "- onConnected"); Log.i(TAG, "- onConnected");
if (isEnabled) {
requestActivityUpdates();
}
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment