找到满足我需求的解决方案:
而不是更新我的令牌,我只是进行 FQL 查询来检索我想知道的权限的远程(最新)状态
以下代码查询有关发布权限(官方称为“publish_actions”):
public void asyncQueryIfHasPublishPermissions() {
String fqlQuery = "SELECT publish_actions FROM permissions WHERE uid = me()";
Bundle params = new Bundle();
params.putString("q", fqlQuery);
Session session = Session.getActiveSession();
Request request = new Request(session,
"/fql",
params,
HttpMethod.GET,
new Request.Callback(){
public void onCompleted(Response response) {
JSONObject graphResponse = response.getGraphObject().getInnerJSONObject();
boolean publishPermissions = false;
try {
if (graphResponse.getJSONArray("data").getJSONObject(0).getInt("publish_actions")==1) {
publishPermissions = true;
}
} catch (JSONException e) {
Log.e("FacebookIntegration", "JSON error "+ e.getMessage());
}
FacebookRequestError error = response.getError();
if (error != null) {
Log.e("FacebookIntegration", "FacebookRequestError "+ error.getErrorMessage());
}
Log.i("FacebookIntegration", "asyncQueryIfHasPublishPermissions response: "+publishPermissions);
}
});
Request.executeBatchAsync(request);
}