Software Archive
Read-only legacy content
17061 Discussions

So Frustrated!

Smith__J
Beginner
1,695 Views

I am still having problems getting the AdMob plugins to work. They appear to be properly installed, with the right code in the header. No ads show.

0 Kudos
23 Replies
Hamilton_Tenório_da_
Valued Contributor I
1,513 Views

I am preparing an APP to show ads. I am using the plugin and everything is working well. But, there is a little detail: I inserted the icon in APP Designer (where I put my ID od Admob) and inform in the PROJECT, tab Plugin an external plugin, not that one offer in the right side. The third-party plugin is com.rjfun.cordova.plugin.admob.

0 Kudos
Smith__J
Beginner
1,513 Views

What do you mean, insert the icon? Insert an image?

Unfortunately, on the app I have been working on, keeps saying the plugin is not installed, when I think it is, and it will now not build. I believe I have the plugin installed correctly, but now keep getting error messages.

If I try your plugin, it will probably just make 3 error messages.

I have attached a screenshot of the current problem, but the AdMob never showed anyways, no matter what plugin I tried.

 

0 Kudos
Hamilton_Tenório_da_
Valued Contributor I
1,513 Views

@J S > the icon that I said is the one of the block WIDGETS of XDK.

I drag & drop the icon to my APP and fill with my ID on Admod. 

After that, I insert a third-part plugin (see image).

It is working OK.

If you want see, the link is https://play.google.com/store/apps/details?id=com.hamiltonhtsnet.com.br.faleparaowhatsapp

I need to rewrite the APP with Framework7. The Appframework with Cordova has a issue and cut the footer when the ad is add.

0 Kudos
Anusha_M_Intel1
Employee
1,513 Views

JS,

Could you send me a dropbox link to your app or zip it here? Let me see if I can help you make admob work. A simple version of your app would work. 

0 Kudos
Smith__J
Beginner
1,513 Views

I have attached a zip of the app I was working on. If I can find a solution to this one, maybe I can get the other 3 to work also.

0 Kudos
Anusha_M_Intel1
Employee
1,513 Views

Here is your app with admob working. Attached. I shrinked your body contents to keep the code simple. 

0 Kudos
Anusha_M_Intel1
Employee
1,513 Views

I didn't track your index.html code. But I definitely noticed that you hadn't added the floatinghotspot admob plugin as a third party plugin. 

https://github.com/floatinghotpot/cordova-plugin-admob

You can find instructions on how to add third party plugins here: https://software.intel.com/en-us/xdk/docs/adding-third-party-plugins-to-your-xdk-cordova-app

The featured plugin in Intel XDK is the Cranberry Admob plugin. If you choose to use this plugin, you can just select it under 'Plugins' in the 'Project' tab. But I have used the floatinghotspot plugin and so it has to be added as a third party plugin. 

0 Kudos
Smith__J
Beginner
1,513 Views

Thanks Anusha, I have the Plugin checked on the build settings, the build says the cranberrygame plugin is installed, so I can use that.

Should I paste this into the head?

<gap:plugin name="com.cranberrygame.phonegap.plugin.ad.admob" source="plugins.cordova.io" />

I also put this in the <head> I am thinking I am not getting the right codes into the html.

var adUnit = "REPLACE_THIS_WITH_YOUR_AD_UNIT";
var adUnitFullScreen = "REPLACE_THIS_WITH_YOUR_AD_UNIT";
var isOverlap = true; //true: overlap, false: split
var isTest = true;
/*
var adUnit;
var adUnitFullScreen;
var isOverlap = true; //true: overlap, false: split
var isTest = true;
//android
if (navigator.userAgent.match(/Android/i)) {
    adUnit = "REPLACE_THIS_WITH_YOUR_ANDROID_AD_UNIT";
    adUnitFullScreen = "REPLACE_THIS_WITH_YOUR_ANDROID_AD_UNIT";
}
//ios
else if (navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i)) {
    adUnit = "REPLACE_THIS_WITH_YOUR_IOS_AD_UNIT";
    adUnitFullScreen = "REPLACE_THIS_WITH_YOUR_IOS_AD_UNIT";
}
//wp8
else if( navigator.userAgent.match(/Windows Phone/i) ) {
    adUnit = "REPLACE_THIS_WITH_YOUR_WP8_AD_UNIT";
    adUnitFullScreen = "REPLACE_THIS_WITH_YOUR_WP8_AD_UNIT";
}
*/

document.addEventListener("deviceready", function(){
    window.admob.setUp(adUnit, adUnitFullScreen, isOverlap, isTest);

    //banner ad callback
    window.admob.onBannerAdPreloaded = function() {
        alert('onBannerAdPreloaded');
    };
    window.admob.onBannerAdLoaded = function() {
        alert('onBannerAdLoaded');
    };
    //full screen ad callback
    window.admob.onFullScreenAdPreloaded = function() {
        alert('onFullScreenAdPreloaded');
    };
    window.admob.onFullScreenAdLoaded = function() {
        alert('onFullScreenAdLoaded');
    };
    window.admob.onFullScreenAdShown = function() {
        alert('onFullScreenAdShown');
    };
    window.admob.onFullScreenAdHidden = function() {
        alert('onFullScreenAdHidden');
    };
}, false);

window.admob.preloadBannerAd();
/*
position: 'top-left', 'top-center', 'top-right', 'left', 'center', 'right', 'bottom-left', 'bottom-center', 'bottom-right'
size:   'BANNER' (320x50, Phones and Tablets)
        'LARGE_BANNER' (320x100, Phones and Tablets)
        'MEDIUM_RECTANGLE' (300x250, Phones and Tablets)
        'FULL_BANNER' (468x60, Tablets)
        'LEADERBOARD' (728x90, Tablets)
        'SKYSCRAPER' (120x600, Tablets, ipad only)
        'SMART_BANNER' (Auto size, Phones and Tablets, recommended)
*/
window.admob.showBannerAd('top-center', 'SMART_BANNER');
window.admob.showBannerAd('bottom-center', 'SMART_BANNER');
window.admob.reloadBannerAd();
window.admob.hideBannerAd();

window.admob.preloadFullScreenAd();
window.admob.showFullScreenAd();
0 Kudos
Anusha_M_Intel1
Employee
1,513 Views

Here is your Crystals app (attached) using the Cranberry admob plugin. Refer to index.html to see where I have included the code. Make sure to remove the alerts. Admob only works on a built app. 

0 Kudos
Smith__J
Beginner
1,513 Views

Thank you so much, Anusha, this is what I have been looking for. :) Now I will be able to build a lot of apps. :)

One last question, how do I remove the alerts? I noticed the fullscreen ad alert. Do I change this to false?  "var isTest = true;"

0 Kudos
Anusha_M_Intel1
Employee
1,513 Views

In  the OnDeviceReady function, there are methods such as onBannerAdPreloaded() and onBannerAdloaded(). These include alerts that have been included for testing. So you know that admob is working and preload and load is happening. Remove the alert when you are ready to publish. 

These are for banner ads:

        window.admob.preloadBannerAd();
        window.admob.showBannerAd('top-center', 'SMART_BANNER');

These are for fullscreen (interstitial) ads:

        window.admob.preloadFullScreenAd();
        window.admob.showFullScreenAd();

Try the sample app provided with the plugin as well: https://github.com/cranberrygame/phonegap-plugin-ad-admob/blob/master/example/basic/index.html

Good Luck :)

0 Kudos
Smith__J
Beginner
1,513 Views

OK, just to get it straight, I would remove the word "alert" in these? Just want to make sure. :)

 //banner ad callback
            window.admob.onBannerAdPreloaded = function () {
                alert('onBannerAdPreloaded');
            };
            window.admob.onBannerAdLoaded = function () {
                alert('onBannerAdLoaded');
            };
            //full screen ad callback
            window.admob.onFullScreenAdPreloaded = function () {
                alert('onFullScreenAdPreloaded');
            };
            window.admob.onFullScreenAdLoaded = function () {
                alert('onFullScreenAdLoaded');
            };
            window.admob.onFullScreenAdShown = function () {
                alert('onFullScreenAdShown');
            };
            window.admob.onFullScreenAdHidden = function () {
                alert('onFullScreenAdHidden');
            };

0 Kudos
Anusha_M_Intel1
Employee
1,513 Views

Yup! That would be it. If you build the app I attached, you can see these alert popping up as admob loads. Just remove those alert lines. 

0 Kudos
Smith__J
Beginner
1,513 Views

OK, thanks a million!

0 Kudos
Smith__J
Beginner
1,513 Views

I think it's still not working; I updated the 4 apps I have with this, and still no impressions at all on AdMob. You would think there would be at least one impression. I am having someone do a custom script for me, that I can edit with Android Studio.

0 Kudos
Anusha_M_Intel1
Employee
1,513 Views

Hi JS,

You are not seeing any ads on your application? If you are following the sample app implementation exactly, I am not sure what the issue is. 

The last thing I can do for you is to try to debug one of your apps. 

0 Kudos
Smith__J
Beginner
1,513 Views

I attached a picture of my AdMob; you can see the 4 apps built with XDK don't have any impressions, even though they were all up dated. They each have 100-400 installs, so they should show something.

If you would like to debug the crystals app, please do. That is the most popular. I have downloaded the apps for test and debug, but can not get them to work. Maybe my Androids don't have the right OS. It would be great to have an online debugger, not dependent on apps.

0 Kudos
PaulF_IntelCorp
Employee
1,513 Views

See this page for some debugging options, especially the option that uses remote Chrome Dev Tools: https://software.intel.com/en-us/xdk/docs/intel-xdk-debug-and-test-overview

0 Kudos
Anusha_M_Intel1
Employee
1,513 Views

J.S,

Your attachment is missing. But I can confirm that the crystals app I sent you was working just fine for me. It showed interstitial and banner ads. If you can't see the ads on the app I sent you.. You are doing something wrong in the procedure. In fact, I sent you two versions using both floatinghotspot and cranberry plugins. Just build the app for android and launch apk on device. 

0 Kudos
Smith__J
Beginner
1,462 Views

Do I need permissions on the projects tab?

The apk you sent me showed the temporary ads, but I needed to update the app version code. Installed the code, removed the alerts, clicked the build tab, uploaded the new version, built the app, but ads don't show. Not sure what else to do.

0 Kudos
Reply