How to force Admob to refresh on Android

后端 未结 7 845
迷失自我
迷失自我 2021-01-07 23:30

I have an app with Admob ads on it but I find that when I use it the ad almost never refreshes because I don\'t change activities, instead I just update a text view when but

7条回答
  •  生来不讨喜
    2021-01-08 00:04

        //New AdRequest 
    
        ScheduledExecutorService scheduleTaskExecutor = Executors.newScheduledThreadPool(5);
    
    
    scheduleTaskExecutor.scheduleAtFixedRate(new Runnable() {
      public void run() {
            runOnUiThread(new Runnable() {
                public void run() {
                     AdRequest adRequest = new AdRequest.Builder().build();
                    adView.loadAd(adRequest);
                }
            });
        }
    
    }, 0, 30, TimeUnit.SECONDS);
    

提交回复
热议问题