How can I get email address after login to twitter? Im using fabric sdk Android

android
fabric

#1

Im using fabric sdk. Its give me null variable when I print to log.


#2

Is your app whitelisted for access to the email address? There is a link in the Fabric docs to apply for access. Once granted, users will see an additional screen indicating that your all is requesting email access.

If the value is null, the the chances are that either the account has no associated email address, or that it was never verified.


#3

This is the reply of twitter support.

This is my code to get email address of user using twiiter login:

loginButton = (TwitterLoginButton) findViewById(R.id.twitter_login_button);
loginButton.setCallback(new Callback() {

        @Override
        public void success(Result<TwitterSession> result) {
            String Username = result.data.getUserName();
            Toast.makeText(MainActivity.this, Username, Toast.LENGTH_LONG).show();
            AccountService ac = Twitter.getApiClient(result.data).getAccountService();
            ac.verifyCredentials(true, true, new Callback<User>() {
                @Override
                public void success(Result<com.twitter.sdk.android.core.models.User> result) {

                    String imageUrl = result.data.profileImageUrl;
                    String email = result.data.email;
                    String Name = result.data.name;
                    long userid = result.data.id;
                    String username = result.data.screenName;

                    System.out.println(imageUrl);
                    System.out.println("EMAIL:" + email);
                    System.out.println("Name:" + Name);
                    System.out.println("ID:" + userid);
                    System.out.println("Username:" + username);
                }

                @Override
                public void failure(TwitterException e) {

                }
            });
        }

        @Override
        public void failure(TwitterException e) {

        }
    });