When I try extend user permissions, the first time that the popup appears, I hit 'cancel' and then I continue playing with the app. The second time that the popup appears in the same session, I hit over 'Accept', but I get this java error:
07-14 22:15:06.425: E/AndroidRuntime(1226): java.lang.UnsupportedOperationException: Session: an attempt was made to request new permissions for a session that has a pending request.
07-14 22:15:06.425: E/AndroidRuntime(1226): at com.facebook.Session.requestNewPermissions(Session.java:968)
07-14 22:15:06.425: E/AndroidRuntime(1226): at com.facebook.Session.requestNewPublishPermissions(Session.java:501)
Anyone knows that could be happening?
I'm using this code
final Session mCurrentSession = Session.getActiveSession();
Request request = Request.newGraphPathRequest(mCurrentSession,
"me/permissions", new Request.Callback() {
@Override
public void onCompleted(Response response) {
// TODO Auto-generated method stub
GraphObject object = response.getGraphObject();
// Log.v("PERMISSIONS", object.getInnerJSONObject()
// .toString());
try {
if (object != null) {
JSONObject jObject = new JSONObject(object
.getInnerJSONObject().toString());
JSONArray jArray = jObject.getJSONArray("data");
JSONObject jObject1 = jArray.getJSONObject(0);
Log.d("XMPP", ""+jObject1);
String per = jObject1.getString("xmpp_login");
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
try {
Session.NewPermissionsRequest request = new Session.NewPermissionsRequest(
CommentsAC.this,
Arrays.asList("xmpp_login"));
mCurrentSession
.requestNewPublishPermissions(request);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
});
Request.executeBatchAsync(request);
0 comments:
Post a Comment