Interstitials for Windows Phone crashes after navigating back to app

273 views
Skip to first unread message

Ingersol

unread,
Mar 21, 2014, 2:59:36 PM3/21/14
to google-adm...@googlegroups.com
Even standart google admob SDK interstitials crashes application.
How to achieve this:

Start standart admob sdk interstitials project, run it
Request ad, show ad. 
Click ad (it will cause navigate  out of the app)
Then navigate back.

Result is crash with message:
"The given key was not present in the dictionary."

and stacktrace:
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at A.c30733e35f890237bcc7d10a76152577a.OnNavigatedTo(NavigationEventArgs e)
   at Microsoft.Phone.Controls.PhoneApplicationPage.InternalOnNavigatedTo(NavigationEventArgs e)
   at Microsoft.Phone.Controls.PhoneApplicationPage.Microsoft.Phone.Controls.IPhoneApplicationPage.InternalOnNavigatedToX(NavigationEventArgs e)
   at System.Windows.Navigation.NavigationService.RaiseNavigated(Object content, Uri uri, NavigationMode mode, Boolean isNavigationInitiator, IPhoneApplicationPage existingContentPage, IPhoneApplicationPage newContentPage)
   at System.Windows.Navigation.NavigationService.Journal_NavigatedExternally(Object sender, JournalEventArgs args)
   at System.Windows.Navigation.Journal.OnNavigatedExternally(String name, Uri uri, NavigationMode mode)
   at System.Windows.Navigation.Journal.DoExternalNavigation(NavigationDirection direction, Boolean isResumeActivation)
   at System.Windows.Navigation.Journal.NavigateTo(NavigationDirection direction, Boolean isResumeActivation)
   at Microsoft.Phone.TaskModel.Interop.Task.FireOnNavigateTo(Int32 direction, Boolean isResumeActivation)

Admob SDK version is 6.5.11.0

Ingersol

unread,
Mar 21, 2014, 3:05:41 PM3/21/14
to google-adm...@googlegroups.com
(Of course it crashes only after succesfull interstitial load so valid admob key is required and AdRequest.ForceTest should be false)

Ingersol

unread,
Mar 22, 2014, 4:03:16 PM3/22/14
to google-adm...@googlegroups.com
Well, with help of ilspy i found problem place, its in
/GoogleAds;component/Overlay.Phone.xaml -related .cs file

protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            string text = c7e565741040f5a35db9c48a57f2ac546.cfa30e252b6291c51bacd4e3385dea6fc(1584);
            this.c8cba3abde308454652fa6860fa4e1565 = base.get_NavigationContext().get_QueryString().get_Item(text);
            object cfdf1654bcd3b2032e5c845d5fce4edb = cbdca9b06c12bb5cc8025ba86c0636908.Instance.get_Item(this.c8cba3abde308454652fa6860fa4e1565);
            this.ViewModel = ccec5ee574749f93902c05ecd2108d6fe.cf363b6443dbb7a6e00e9bf15d0f3eece(cfdf1654bcd3b2032e5c845d5fce4edb);
            this.ViewModel.OnShow.Invoke();
        }
As you see, NavigationContext.QueryString.Item was called without any checks. So, when user goes back to application it will open this page without parameters and code will crash.

What you should do:
 1) Check if key exists "if NavigationContext.QueryString.ContainsKey(text)" ...
or (much much better)
 2) Exclude banner page from navigation stack immediatelly after user clicked to banner. It will not only help with crash, it will
eliminate "second navigation to banner page when user navigates back from the outside".

Pierluca Conti

unread,
Mar 28, 2014, 12:56:08 PM3/28/14
to google-adm...@googlegroups.com
I have the same problem but I have not understood how to solve..
I have this code:

 NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
 interstitialAd.ReceivedAd += OnAdReceived;
 interstitialAd.FailedToReceiveAd += interstitialAd_FailedToReceiveAd;
 interstitialAd.LoadAd(adRequest);

I have tried various combinations with NavigationService.RemoveBackEntry() but always crashes
Can you explain me how to solve with a simple example? Thank you

Ingersol

unread,
Mar 31, 2014, 2:05:44 PM3/31/14
to google-adm...@googlegroups.com
I wrote code to help google developers fix their library :)
On user side we cant do much.

However, one thing we can do - "hack" google admob library and change its IL code.
 Anyway its useless until they fix "interstitial shift image" bug.

Reply all
Reply to author
Forward
0 new messages