Closed QuickBrownFoxy closed 9 years ago
Simply run below to test
private void blockingTest() { final HandlerThread bcThread = new HandlerThread("blockingConnectThread"); bcThread.start(); final Handler bcHandler = new Handler(bcThread.getLooper());
final HandlerThread cbThread = new HandlerThread("callbackThread");
cbThread.start();
final Handler cbHandler = new Handler(cbThread.getLooper());
final GoogleApiClient apiClient = new GoogleApiClient.Builder(this)
.addApi(Drive.API)
.addScope(Drive.SCOPE_FILE)
.setHandler(cbHandler)
.build();
bcHandler.post(new Runnable() {
@Override
public void run() {
ConnectionResult connectionResult = apiClient.blockingConnect();
if (connectionResult.isSuccess()) {
Log.e("TAG", "apiClient connectionResult was successful. Return client");
} else {
Log.e("TAG","resolveIssue connectionResult error code was : "+ connectionResult.getErrorCode() + " hasRes: " + connectionResult.hasResolution());
}
}
});
}
Is it necessary to use a handler to connect here? Either way I'd suggest not using the same callback to handle callbacks (setHandler) and connecting GoogleApiClient.
It wasn't that, there was a known issue with google play services and has been fixed with the latest release'
Thanks for the update @nolovelust
ConnectionResult connectionResult = mGoogleApiClientBlocking.blockingConnect(WAITTM, TimeUnit.MILLISECONDS);
is always CANCELED I have just tested with version 24 too