how to run a method only once in android kotlin

 val ses: ScheduledExecutorService = Executors.newScheduledThreadPool(1)


ses.scheduleAtFixedRate({

    Log.d("TAG", "The interstitial ad wasn't ready yet1.")

    mInterstitialAd?.show(this@ShowResultActivity)

    if (mInterstitialAd != null) {

        mInterstitialAd?.show(this@ShowResultActivity)

    } else {

        Log.d("TAG", "The interstitial ad wasn't ready yet11.")

    }

}, 5, 3, TimeUnit.SECONDS)


Post a Comment

Previous Post Next Post