We are trying to request email using Twitter SDK in our Android app.
Our twitter app (created via apps.twitter.com) has the Access Level set to “Read, write, and direct messages Can request a user’s email address”.
But we always receive the following Exception:
“Your application may not have access to email addresses or the user may not have an email address. To request access, please visit https://support.twitter.com/forms/platform.”
Following our implementation in our Android app.
- In
Manifest.xml:
<meta-data
android:name="io.fabric.ApiKey"
android:value="OUR_FABRIC_API_KEY"
/>
- We have initialized Fabric SDK with the following code:
`TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET);
Fabric.with(this, new Twitter(authConfig));
Where TWITTER_KEY and TWITTER_SECRET are the keys listed for our Twitter app.
- Then we request authorization and the email with the following code:
TwitterAuthClient client = new TwitterAuthClient();
client.authorize(activity, new Callback<TwitterSession>() {
@Override
public void success(Result<TwitterSession> twitterSessionResult) {
final Result<TwitterSession> result = twitterSessionResult;
AsyncTask.execute(new Runnable() {
@Override
public void run() {
TwitterSession session = result.data;
TwitterAuthClient authClient = new TwitterAuthClient();
authClient.requestEmail(session, new Callback<String>() {
@Override
public void success(Result<String> result) {
// Do something with the result, which provides the email address
Log.d("TwitterKit", "email-->" + result.data);
}
@Override
public void failure(TwitterException exception) {
// It always rise here
Log.d("TwitterKit", "KO email->" + exception.getLocalizedMessage());
}
});
}
});
}
@Override
public void failure(TwitterException e) {
Log.w("TwitterKit", "KO authorize->" + e.getLocalizedMessage());
}
});
We’ve already done the following steps:
-
add links to your Terms and Conditions and Privacy Policy under the Settings tab. Then, we have checked the Request email addresses from users box under the Permissions tab.
-
request to add all fabric permissions to app.
-
revoke and regenerate old access tokens with old permission sets (many times).
Why we still not able to get email?
Thanks in advance.