I have an app that uses Android Wear API. To create it I followed the guides here:
https://developer.android.com/training/building-wearables.html
I access the wearable APIs using:
new GoogleApiClient.Builder(context)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Wearable.API)
.build();
In my onConnectionFailedListener
, I am getting an error code 16, resulting in a popup to the user saying "GooglePlayServicesUtil﹕ Unexpected error code 16".
@Override
public void onConnectionFailed(ConnectionResult result) {
if (mResolvingError) {
// Already attempting to resolve an error.
return;
} else if (result.hasResolution()) {
try {
mResolvingError = true;
result.startResolutionForResult(this, REQUEST_RESOLVE_ERROR);
} catch (SendIntentException e) {
// There was an error with the resolution intent. Try again.
mGoogleApiClient.connect();
}
} else {
// Show dialog using GooglePlayServicesUtil.getErrorDialog()
showErrorDialog(result.getErrorCode());
mResolvingError = true;
}
}
I couldn't find an answer to why this happens in an SO question, so I will add my own.