Пример #1
0
        async void ShowInterstitial()
        {
            do
            {
                await Task.Delay(100);
            } while (!adInterstitial.IsReady);

            InvokeOnMainThread(() => adInterstitial.PresentFromRootViewController(navController));
        }
Пример #2
0
        public void Show(string adUnit)
        {
            _adInterstitial = new GADInterstitial(adUnit);
            var request = GADRequest.Request;

            _adInterstitial.AdReceived += (sender, args) =>
            {
                if (_adInterstitial.IsReady)
                {
                    var window = UIApplication.SharedApplication.KeyWindow;
                    var vc     = window.RootViewController;
                    while (vc.PresentedViewController != null)
                    {
                        vc = vc.PresentedViewController;
                    }
                    _adInterstitial.PresentFromRootViewController(vc);
                }
            };
            _adInterstitial.LoadRequest(request);
        }