new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/me",
parameters,
HttpMethod.GET,
new GraphRequest.Callback(){
@Override
public void onCompleted(GraphResponse response){
if (response.getError() != null){
Toast.makeText(AccountActivity.this, response.getError().getErrorMessage(), Toast.LENGTH_LONG).show();
return;
}
JSONObject jsonResponse = response.getJSONObject();
try {
String locationStr = jsonResponse.getString("location");
location.setText(locationStr);
} catch (JSONException e){
e.printStackTrace();
}
}
}
).executeAsync();
{
"location": {
"id": "107413405955233",
"name": "Huntington Beach, California"
},
"id": "128607281023401"
}
Bundle parameters = new Bundle();
parameters.putString("message", "Access Denied");
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/me/feed",
parameters,
HttpMethod.POST,
new GraphRequest.Callback(){
@Override
public void onCompleted(GraphResponse response){
if (response.getError() != null){
Toast.makeText(MainActivity.this, response.getError().getErrorMessage(), Toast.LENGTH_LONG).show();
return;
}
}
}
).executeAsync();