-1
    override fun onCreate(savedInstanceState: Bundle?) {
        initIntestinalAd()
    }

  private fun initIntestinalAd() {
        val handler = Handler(Looper.getMainLooper())
        handler.postDelayed(object: Runnable{
            override fun run() {
                Utils.loadInterstitialAd(applicationContext)
                handler.postDelayed(this, 120000)
            }
        }, 30000)
    }

Hello, since the application does not have a click function, I had to add the advertisement like this, but when the application is closed, the advertisement appears only when the application is active, how can I make it work?

vanje
  • 10,180
  • 2
  • 31
  • 47

1 Answers1

0

I am not sure if I have misinterpreted your question:
Do you mean that you would like to display your Advertisement periodically, even your App is closed?

If so, you should consider implementing Background Service instead of doing so in your App. Because if your App is killed, very likely the periodic task implemented in your Activity will stop.

You may refer to the following posts as a starting point:

Enowneb
  • 943
  • 1
  • 2
  • 11