sofquestion 9
sofquestion 9

Reputation: 167

How to check to facebook app storage permission is denied or allowed through my android app?

I'm creating one application in that app am using share intent to share info in social networks, sharing is working perfectly in my application(Marshmallow), but my question is if the user denied storage permission in Facebook application, how to check that Facebook application storage permission is on or not through my android application while sharing. Below is the code::-

 @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    Toast.makeText(context, "RESULT : " + requestCode + "-" + resultCode,
            Toast.LENGTH_SHORT).show();
    switch (requestCode) {
        case 1:
            if (requestCode == 1) {
                Toast.makeText(getApplicationContext(), "Successfully Sharing", Toast.LENGTH_LONG).show();
                Log.d("tag share--", "share");

            }
           else{
                Toast.makeText(getApplicationContext(), "UnSuccessfully Sharing", Toast.LENGTH_LONG).show();
                Log.d("tag unshare--", "unshare");
            }
            break;
        default:
            break;
    }
}

Upvotes: 1

Views: 476

Answers (1)

Fuat Coşkun
Fuat Coşkun

Reputation: 1055

After authenticating with your user you will get an access token which you can check your permissions by AccessToken class of facebook android sdk.

AccessToken.getCurrentAccessToken().getPermissons()

will give you list of permissions you have.

You better check this documentation about AccessToken https://developers.facebook.com/docs/reference/android/current/class/AccessToken/

Upvotes: -1

Related Questions