SurfaceView integrate interstitial ads?

  android, android-studio, interstitial, java, loadview

currently I finished first simple game Android and try to integrate interstitial to my game, but I faced issue:
I used SurfaceView for my game, that is forever loop and draw continually and I don’t know where can I put interstitial ads code, if I put interstitial ads code on void run() it will be stuck and cant show ads, my app was crashed.

public void run() {
   while (running) {
      // my code: draw something

     // where can I put interstitial ads code

   }
}

sorry, I am new
could you give some suggestion for this issue ?

Thank you.

Source: Android Questions

LEAVE A COMMENT