{"id":3170,"date":"2014-03-19T01:44:58","date_gmt":"2014-03-19T01:44:58","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/19\/adview-js-uncaught-referenceerror-afma_getsdkconstants-is-not-defined-http-media-admob-com-1-collection-of-common-programming-errors\/"},"modified":"2014-03-19T01:44:58","modified_gmt":"2014-03-19T01:44:58","slug":"adview-js-uncaught-referenceerror-afma_getsdkconstants-is-not-defined-http-media-admob-com-1-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/19\/adview-js-uncaught-referenceerror-afma_getsdkconstants-is-not-defined-http-media-admob-com-1-collection-of-common-programming-errors\/","title":{"rendered":"AdView : JS: Uncaught ReferenceError: AFMA_getSdkConstants is not defined (http:\/\/media.admob.com\/:1)-Collection of common programming errors"},"content":{"rendered":"<p>I have such layout as :<\/p>\n<pre><code>\n     \n      \n           \n         \n\n            \n\n \n<\/code><\/pre>\n<p>THis is how I download ad :<\/p>\n<pre><code>if (isOnline())\n    {\n        adView.loadAd(new AdRequest());\n    }\n    else\n    {\n        adView.setVisibility(View.GONE);\n    }\n<\/code><\/pre>\n<p>isOnLine method checks the internet connection :<\/p>\n<pre><code>public boolean isOnline() {\n   boolean res = false;\n    ConnectivityManager cm = (ConnectivityManager) this.getSystemService(Context.CONNECTIVITY_SERVICE);\n    NetworkInfo netInfo = cm.getActiveNetworkInfo();\n    if (netInfo != null &amp;&amp; netInfo.isConnectedOrConnecting()) {\n       res= true;\n    }\n    else\n    {\n       res = false;\n     }\n    return res;\n}\n<\/code><\/pre>\n<p>I tried to get help from this answer and download ad in another thread, but it doesn&#8217;t help me.<\/p>\n<p>When I open my activity with the ad it do not opens sometimes and I get next exceptions:<\/p>\n<pre><code>    10-01 12:24:43.423: E\/Ads(26065): JS: Uncaught ReferenceError: AFMA_getSdkConstants is not defined (http:\/\/media.admob.com\/:1)\n10-01 12:24:43.423: E\/Web Console(26065): Uncaught ReferenceError: AFMA_getSdkConstants is not defined at http:\/\/media.admob.com\/:1\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I have such layout as : THis is how I download ad : if (isOnline()) { adView.loadAd(new AdRequest()); } else { adView.setVisibility(View.GONE); } isOnLine method checks the internet connection : public boolean isOnline() { boolean res = false; ConnectivityManager cm = (ConnectivityManager) this.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo netInfo = cm.getActiveNetworkInfo(); if (netInfo != null &amp;&amp; netInfo.isConnectedOrConnecting()) { res= [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3170","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3170","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3170"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3170\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3170"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3170"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3170"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}