android-simple-facebook
android-simple-facebook copied to clipboard
Fail when trying to request new permissions
Hi, I am trying to request new permissions but I always get onFail() with the reason: "User canceled the permissions dialog", do you know what might be causing this? The Facebook dialog is only visible for a split second but then it disappears.
Application:
Permission[] permissions = new Permission[]{
Permission.PUBLIC_PROFILE,
Permission.EMAIL,
Permission.USER_BIRTHDAY
};
SimpleFacebookConfiguration configuration = new SimpleFacebookConfiguration.Builder()
.setAppId(getString(R.string.facebook_app_id))
.setNamespace("")
.setPermissions(permissions)
.build();
SimpleFacebook.setConfiguration(configuration);
Activity:
public void requestPermissions(){ Permission[] permissions = new Permission[] { Permission.PUBLISH_ACTION };
simpleFacebook.requestNewPermissions(permissions, onNewPermissionsListener);
}
OnNewPermissionsListener onNewPermissionsListener = new OnNewPermissionsListener() {
@Override
public void onSuccess(String accessToken, List<Permission> acceptedPermissions, List<Permission> declinedPermissions) {
// updated access token
Log.d(TAG, "success permissions");
}
@Override
public void onCancel() {
// user canceled the dialog
Log.d(TAG, "cancel permissions");
}
@Override
public void onFail(String reason) {
// failed
Log.d(TAG, "fail permissions:" + reason );
}
@Override
public void onException(Throwable throwable) {
// exception from facebook
Log.d(TAG, "exeption permissions");
}
};
@magnearun thanks for reporting this. In fact, I am trying to figure out what might be the cause for such issue. This is a similar ticket #327 where the exact scenario happening. I have to admit that for now, I have no good answer. It works on my device, it works on many other devices, accounts, android versions, with/without installed facebook app, but for some reason it fails on others.
Thanks for the answer, but yeah it seems to work on some devices and not on others, I have tested it on 5 devices, it only works on one of them.
Interesting, and what is the account you are using when you login? Is it a regular account? Was it the same account on all devices you tried?
I have tested it with both my personal Facebook account, with a new test account I made and then some of the beta tester of the app I´m working on have tried it with their accounts. I have no problems signing in and asking for permissions then, this only happens when I want to request new permissions after the user has signed in. I have had it work with my personal account on one device and not on another, both running the same version of Android.
Which makes me think that if you are logged in with the same account on more than one device in the same time, then it happens that one of the devices makes some troubles? maybe.. ok, I will get into it and digg more later today with more devices. Will keep you updated.
Yeah maybe, but it also happens when I create a new Facebook account.
Thanks, I will be working on this tomorrow, just let me know if you need more info.
@sromku @magnearun I am facing with the same issue. Is there any solution?
any update ?