Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AFMA_ReceiveMessage is not defined

Tags:

android

admob

I am integrating AdMob in my android app. The code for the add part is pretty simple and almost straight from Google Developer's guide. I am trying to implement Interstitials. The ads are showing fine but I am getting this in stackTrace in red:

E/Ads(21443): JS: Uncaught ReferenceError: AFMA_ReceiveMessage is not defined (null:1)

Can anyone tell me what it means? Is it ok to release the app with this error as it doesn't crash the app?

EDIT: I just noticed that this error is being received for a specific ad and not for the other(just getting two ads in my country for now). So maybe it's just something missing from Publisher end.

like image 528
Saad Ali Avatar asked Jan 14 '14 16:01

Saad Ali


2 Answers

If this is the testing device you should call AddTestDevice("your tester device code you can got it from logCat when you start the App"). If not it should work fine in the production environment.

Tester :

AdView mAdView = (AdView)rootView.findViewById(R.id.adView);
Builder adRequest = new AdRequest.Builder().addTestDevice("3F166F686479332267DD2DCCD89dfwrg");
AdRequest aaa=adRequest.build();
mAdView.loadAd(aaa);

Production:

AdView mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
like image 190
ahmadzuhair Avatar answered Sep 18 '22 14:09

ahmadzuhair


You'll need to create a thread to load Ads.

new Thread(new Runnable() {
        public void run() {
            here your code to load banner ...
        }
    }).start();

For more documentation go to android developer's documentations on threads: http://developer.android.com/guide/components/processes-and-threads.html

If it returns error asking you to use main UiThread use following code in your Activity

runOnUiThread(new Runnable() {
                public void run() {
                    interstitialAd.show();
                }
            });
like image 24
AJMolano Avatar answered Sep 22 '22 14:09

AJMolano