我发疯了,请帮帮我.. 我已经关注了教程页面,但没有成功,
但似乎没有任何效果。
我收到这个愚蠢的错误:连接结果{statusCode =未知状态代码5005,分辨率= null}
愚蠢而复杂的开发者控制台..
请帮帮我
今天它有效。可能是错误的包装名称。
解决
答案 0 :(得分:-1)
只需更改包名称.. 这是api客户端
private void buildFitnessClient() {
fitnessClient = new GoogleApiClient.Builder(context)
.addApi(Fitness.HISTORY_API)
.addApi(Fitness.SESSIONS_API)
.addScope(new Scope(Scopes.FITNESS_BODY_READ_WRITE))
.addScope(new Scope(Scopes.FITNESS_ACTIVITY_READ_WRITE))
.addScope(new Scope(Scopes.FITNESS_LOCATION_READ_WRITE))
.addScope(new Scope(Scopes.FITNESS_NUTRITION_READ_WRITE))
.addConnectionCallbacks(
new GoogleApiClient.ConnectionCallbacks() {
@Override
public void onConnected(Bundle bundle) {
ReferenceWrapper.getInstance(context)
.setApiClient(fitnessClient);
((OnClientConnectListener) context)
.onclientConnected();
Log.e("Google fit", "connected");
}
@Override
public void onConnectionSuspended(int i) {
}
})
.addOnConnectionFailedListener(
new GoogleApiClient.OnConnectionFailedListener() {
// Called whenever the API client fails to connect.
@Override
public void onConnectionFailed(
ConnectionResult result) {
if (!result.hasResolution()) {
GooglePlayServicesUtil.getErrorDialog(
result.getErrorCode(), context, 0)
.show();
return;
}
if (!authInProgress) {
try {
authInProgress = true;
result.startResolutionForResult(
context,
KeyConstant.REQUEST_OAUTH);
} catch (IntentSender.SendIntentException e) {
}
}
}
}).build();
}