How to avoid Admob blocking the UI thread

后端 未结 4 1581
忘了有多久
忘了有多久 2020-12-16 18:04

I have detected some of my activities are blocked at the launch. So I wrote that code in a new project:

public class LayoutTestActivity extends Activity {

          


        
4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-16 18:28

    In my case I requested too much advertisement items in one request. The heap is overloaded and GC started action and it blocked my Main thread. The piece of advice try to avoid requesting too much Ad in one request.

    adLoader.loadAds(AdRequest.Builder().build(), 1)
    

提交回复
热议问题