I am getting this exception each time I am trying to get user callback:
E/Twitter: Failed to get user data Request Failure
Here is the code that generated the exception:

 final Call<User> getUserCall = twitterApiClient.getAccountService().verifyCredentials( true,false, true);
         getUserCall.enqueue(new Callback<User>() {
            @Override
            public void success(Result<User> result) {

                String socialId = "", firstName = "", lastName = "", gender = "", birthday = "", email = "", picture = "";

                User user = result.data;
                socialId = user.idStr;
                email = user.email;
                Log.d(TAG, "success: result: "+ result.response.message());
            /*picture = user.profileImageUrlHttps.replace("_normal", "");
            firstName = user.name;
            lastName = user.screenName;*/

                try {
                    firstName = user.name.split(" ")[0];
                    lastName = user.name.split(" ")[1];
                } catch (Exception e) {
                    firstName = user.name;
                    lastName = "";
                }

                userName.setText(firstName + " " + lastName);


                Log.e("Twitter", "SocialId: " + socialId + "\tFirstName: " + firstName + "\tLastName: " + lastName + "\tEmail: " + email);
            }

            @Override
            public void failure(TwitterException exception) {
                Log.e("Twitter", "Failed to get user data " + exception.getMessage());
            }
        });

What library is this? is it up to date? can you make a successful call with the keys you have using GitHub - twitter/twurl: OAuth-enabled curl for the Twitter API ?

Yes, I can make a call and get the username,
twitterSession.getUserName();
It means, the tokens are accepted by the API. And the connection is getting through, I guess, because the username is retrieving from the API.

What’s the library you’re using and what’s the exact error returned by twitter?

Thank you IgorBrigadir for your help, I am using ‘com.twitter.sdk.android:twitter:3.1.1’.
I managed to get some data after several tries.
Now I have two problems:
First: how can I log out and allow the user to log in again?
I tried TwitterCore.getInstance().getSessionManager().clearActiveSession();
but it doesn’t work, I am still able to display the timeline.

Second: how can I add OnItemClickListener to TweetTimelineListAdapter?

Thanks.

Sounds like it’s GitHub - twitter-archive/twitter-kit-android: Twitter Kit for Android twitter kit right? I think that got dropped and is no longer supported - i’m not familiar enough with that library to know exactly what’s missing - your best bet may be stackoverflow if the latest version still works for you.

Got dropped? Which one is the latest now? I am working in a simple Twitter client to display timeline, search, tweet, and retweet.
any suggestions?

I think the way to do it is to use a WebView or something and publish.twitter.com to display stuff, or make your own things using the REST APIs directly

Unfortunately Twitter Kit went out of support in October 2018, with no direct replacement from Twitter. My observation is that Android developers have typically used third party libraries such as either Twitter4J or a Kotlin library to do native coding against the Twitter API, or use the supported Twitter web embeds provided via publish.twitter.com

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.