exception for pause

Hello Everyone,

I have made a game like if you leave the game it will return to the begin scene.
But then I got the problem with showing advertisement. If the ad is showing it
makes the game pause to, so i don’t know how to make an expectation for the advertisement.
This is the script that does the pausing.

    void OnApplicationPause(bool paused)
    {
        Debug.Log("APP PAUSED: " + paused);  // prints APP PAUSED: True when paused
        if (!paused)
        {
            SceneManager.LoadScene("Returntobegin");
            Debug.Log("RESUMING...");
        }
    }

https://docs.unity3d.com/ScriptReference/Advertisements.Advertisement.html

there is an isShowing propery