twitter-archive / twitter-kit-android

Twitter Kit for Android
https://dev.twitter.com/twitterkit/android/overview
Apache License 2.0
832 stars 342 forks source link

TweetUtils cause freez of main thread. #109

Open AppGrade-D opened 6 years ago

AppGrade-D commented 6 years ago

hello, In my applizacion I want to display TweetView in RecyclerView item. I have added dependencies for app module gradle file:

compile 'com.twitter.sdk.android:twitter-core:3.2.0' compile 'com.twitter.sdk.android:tweet-ui:3.2.0'

I'm initialising Twitter in App onCreate() method:

val config = TwitterConfig.Builder(this) .logger(DefaultLogger(Log.DEBUG)) .twitterAuthConfig(TwitterAuthConfig(...)) .debug(true) .build() Twitter.initialize(config)

And here is how I load tweet:

`

TweetUtils.loadTweet(id, object : Callback<Tweet>() {
            override fun success(result: Result<Tweet>) {
                viewHolder.tweetViewRoot.addView(TweetView(viewHolder.itemView.context, result.data))
            }
        override fun failure(exception: TwitterException) {
            Log.d("TwitterRecycleItem", "---> failure()", exception)
        }
    })

`

It is called inside onBindViewHolder(...) method.

On the first load after application start, method invocation TweetUtils.loadTweet(...) cause freez of main thread for 4-5 seconds. When I enter to screen with TweetView second time it loads without any freez.

here is what I have noticed in logs during freez:

Twitter: Could not call getAdvertisingIdInfo on com.google.android.gms.ads.identifier.AdvertisingIdClient Twitter: Could not call isLimitAdTrackingEnabled on com.google.android.gms.ads.identifier.AdvertisingIdClient$Info Twitter: AdvertisingInfo not present

There is someting that I have missed?

Tested on Android 7.0

mikescamell commented 6 years ago

I've been seeing this issue as well with 3.2.0 but this has also been raised here #89