Hi Mike,
Thanks for your reply…
I correct my code with your suggestion:
in AndroidManifest.xml
In my activity:
private TwitterAuthClient client;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TwitterAuthConfig authConfig = new TwitterAuthConfig(Constants.TWITTER_KEY, Constants.TWITTER_SECRET);
Fabric.with(this, new Twitter(authConfig));
client = new TwitterAuthClient();
}
The TWITTER_KEY and the Key in Android Manifest is the same.
I have a function:
public void LoginTwitter(){
TwitterSession session = Twitter.getSessionManager().getActiveSession();
if (session==null){
client.authorize(this, new Callback<TwitterSession>() {
@Override
public void success(Result<TwitterSession> twitterSessionResult) {
Log.i(Constants.TAG, "ONSUCCESS");
TwitterSession session = Twitter.getSessionManager().getActiveSession();
TwitterAuthToken authToken = session.getAuthToken();
TwitterAuthClient authClient = new TwitterAuthClient();
//retry_information_TW();
authClient.requestEmail(session, new Callback<String>() {
@Override
public void success(Result<String> result) {
// Do something with the result, which provides the email address
Log.i(Constants.TAG, "EMAIL: " + result.toString());
retry_information_TW();
}
@Override
public void failure(TwitterException exception) {
// Do something on failure
Log.i(Constants.TAG, "ERROR: " + exception.getMessage());
retry_information_TW();
}
});
}
@Override
public void failure(TwitterException e) {
Log.i(Constants.TAG, "ERR:" + e.getMessage());
}
});
}else {
TwitterAuthToken authToken = session.getAuthToken();
Log.i(Constants.TAG, "TW SEGRET:" + authToken.secret);
Log.i(Constants.TAG, "TW TOKEN:" + authToken.token);
retry_information_TW();
}
}
The Autenthication resolve without problem, but when I request the email , I have the same problem:
Your application may not have access to email addresses or the user may not have an email address.
Have you any idea about?
Thanks
Michele