parse login through Facebook api 4.0 in android studio

前端 未结 5 1169
小鲜肉
小鲜肉 2020-12-19 03:44

My code is.

 private void facebook() {

 List permissions = Arrays.asList(\"public_profile\", \"email\");

    ParseFacebookUtils.logInWithRead         


        
5条回答
  •  执念已碎
    2020-12-19 04:37

    Not sure but check the Key Hash settings on https://developers.facebook.com for your app. You need to have both key hashes for release and debug version set in app developer console. It might be that you've just set the key hash for the debug environment. For more see Setting a Release Key Hash. Hope it helps.

      ParseFacebookUtils.logInWithReadPermissionsInBackground(this, Arrays.asList("email", "user_photos", "public_profile", "user_friends")
                , new LogInCallback() {
            @Override
            public void done(ParseUser user, ParseException err) {
                if (user == null) {
                    Toast.makeText(Form.this,"User Already logged up through Twitter!",Toast.LENGTH_LONG).show();
                } else if (user.isNew()) {
    
    
                } else {
    
                    Toast.makeText(Form.this,"User Already logged up through Facebook!",Toast.LENGTH_LONG).show();
    
    
                }
            }
    
        });
    

    Add this also..

      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    ParseFacebookUtils.onActivityResult(requestCode, resultCode, data);
     }    
    

    this code is working perfect..

提交回复
热议问题