我想知道如何保存并在Facebook sdk(Android)中获得分数。他们用几句话解释了这一点,但我对此一无所知:S。如何通过分数询问然后处理结果?这是我的代码:
Bundle param = new Bundle();
param.putInt("score", myScore);
accessToken = AccessToken.getCurrentAccessToken();
new GraphRequest(
accessToken,
"/me/scores",
param,
HttpMethod.POST,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
}
}
).executeAsync();
accessToken = AccessToken.getCurrentAccessToken();
new GraphRequest(
accessToken,
"/me/scores",
null,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
try {
fbTotalScore = response.getJSONObject().getInt("score");
} catch (JSONException e) {
e.printStackTrace();
}
tvTotalPushUps.setText(String.valueOf(fbTotalScore));
}
}
).executeAsync();