cordova-plugin-admob-free icon indicating copy to clipboard operation
cordova-plugin-admob-free copied to clipboard

Not showing in real device

Open xxx44yyy opened this issue 7 years ago • 45 comments

After run example app (https://github.com/ratson/cordova-plugin-admob-free/tree/master/examples) on real device, ads not showing. isTesting: true and autoShow: true included.

Is that right?

xxx44yyy avatar Oct 16 '18 11:10 xxx44yyy

Same case for me, real ads not showing in device, please somebody tell me why?

ConcaveIT avatar Oct 16 '18 15:10 ConcaveIT

did according to the instructions? https://developers.google.com/admob/android/quick-start

Winamp9 avatar Oct 16 '18 16:10 Winamp9

Yes, Real Ads showing on ionic DevApp but not in production apk.(emulator or real devices)

ConcaveIT avatar Oct 16 '18 16:10 ConcaveIT

Emulator show production and test ads. Real device does not show anything.

@Winamp9 What can help guide for Android? We are trying to use Cordova :)

xxx44yyy avatar Oct 16 '18 17:10 xxx44yyy

We can try this: https://stackoverflow.com/questions/52142760/the-banner-not-showing-with-my-id-from-admob-ionic-3

xxx44yyy avatar Oct 16 '18 17:10 xxx44yyy

Is this worked for you? And have you publish your app to play store? @xxx44yyy

ConcaveIT avatar Oct 16 '18 17:10 ConcaveIT

I can't find a solution to the problem, so I'll probably try to publish the app. But not today, maybe tomorrow.

xxx44yyy avatar Oct 16 '18 17:10 xxx44yyy

I haven't play store account yet. may be that should work. Please let me know if you find any solution, (same for me also)

ConcaveIT avatar Oct 16 '18 17:10 ConcaveIT

Yeah, okay. I will still look for a solution and if I do not find it, I will have to try to publish it.

xxx44yyy avatar Oct 16 '18 17:10 xxx44yyy

@ConcaveIT It worked. I added this to the configuration: "cordova-admob-sdk": "0.20.0"

and this

    <plugin name="cordova-admob-sdk" spec="../plugins/cordova-admob-sdk">
        <variable name="PLAY_SERVICES_VERSION" value="+" />
    </plugin>

After that, a banner (test ads) appeared on the real phone.

2018-10-17 13 05 52

Then, I published the application and it appeared real advertising (of course, the code has already turned off the parameter isTesting). https://play.google.com/store/apps/details?id=com.a2_finance.cordova.test.ads I think Google will swear that I published such an application, so I will delete it today.

You can download the APK (https://apkpure.com/ru/cordova-ads-test/com.a2_finance.cordova.test.ads), and decompile it.

xxx44yyy avatar Oct 17 '18 10:10 xxx44yyy

@xxx44yyy Thanks mate. So… is it required to publish the app to play store?

ConcaveIT avatar Oct 17 '18 13:10 ConcaveIT

To see real advertising - apparently Yes.

xxx44yyy avatar Oct 17 '18 15:10 xxx44yyy

"cordova-admob-sdk": "0.20.0"

where i can add this ? "cordova-admob-sdk": "0.20.0"

yacinknn avatar Oct 17 '18 16:10 yacinknn

@yacinknn,,, you have to add that in config.xml

ConcaveIT avatar Oct 17 '18 16:10 ConcaveIT

bro thank u it worked for me but i have 2 questions : 1-the banner ads display But not always ( Only sometimes ) why ? 2- i want to display interstitial ads but automaticaly ( like in plugin of admobpro ) how can i do it? thank u very much

yacinknn avatar Oct 17 '18 17:10 yacinknn

@Yacinknn, can you share your code?

ConcaveIT avatar Oct 17 '18 17:10 ConcaveIT

@yacinknn

  1. it's normal if ads real (not test)
    admob.interstitial.config({
        id: admobid.interstitial,
        // isTesting: true,
        autoShow: true,
    });

xxx44yyy avatar Oct 17 '18 17:10 xxx44yyy

i use same code 👍 var admobid = {} if (/(android)/i.test(navigator.userAgent)) { // for android & amazon-fireos admobid = { banner: 'ca-app-pub-3940256099942544/6300978111', interstitial: 'ca-app-pub-3940256099942544/1033173712', } } else if (/(ipod|iphone|ipad)/i.test(navigator.userAgent)) { // for ios admobid = { banner: 'ca-app-pub-3940256099942544/2934735716', interstitial: 'ca-app-pub-3940256099942544/4411468910', } }

document.addEventListener('deviceready', function() { admob.banner.config({ id: admobid.banner, isTesting: true, autoShow: true, }) admob.banner.prepare()

admob.interstitial.config({ id: admobid.interstitial, isTesting: true, autoShow: false, }) admob.interstitial.prepare()

document.getElementById('showAd').disabled = true document.getElementById('showAd').onclick = function() { admob.interstitial.show() }

}, false)

document.addEventListener('admob.banner.events.LOAD_FAIL', function(event) { console.log(event) })

document.addEventListener('admob.interstitial.events.LOAD_FAIL', function(event) { console.log(event) })

document.addEventListener('admob.interstitial.events.LOAD', function(event) { console.log(event) document.getElementById('showAd').disabled = false })

document.addEventListener('admob.interstitial.events.CLOSE', function(event) { console.log(event)

admob.interstitial.prepare() })

yacinknn avatar Oct 17 '18 17:10 yacinknn

If you use autoShow : false then you have to call it on. .then Other wise use true

ConcaveIT avatar Oct 17 '18 17:10 ConcaveIT

it worked for me , if i use the value of autoShow =true ? is it ok?

yacinknn avatar Oct 17 '18 17:10 yacinknn

Confusion about one thing some apps does not belongs to play store but they shows real admob ad. How?

ConcaveIT avatar Oct 17 '18 17:10 ConcaveIT

@ConcaveIT They're probably using test IDs. https://developers.google.com/admob/android/test-ads

xxx44yyy avatar Oct 17 '18 17:10 xxx44yyy

@xxx44yyy, No, because they do clicking business. Other thing, you can check removing apps from play store, and see what happens.

ConcaveIT avatar Oct 17 '18 18:10 ConcaveIT

@ConcaveIT To create an ad unit in Admob, you need an ID from GooglePlay. Therefore, I think if you remove the application from GooglePlay, then nothing will change, because in Admob the application will be registered.

But it doesn't matter now. The important thing is that: a) test ads is shown (on emulator - Yes, on real device - Yes) b) real ads is shown (on emulator - No, on real device - Yes, after publication in Google Play)

xxx44yyy avatar Oct 17 '18 18:10 xxx44yyy

But interesting thing is, if you run your app in ionic DevApp then real ads shows. Even when app is not in play store.

ConcaveIT avatar Oct 17 '18 18:10 ConcaveIT

I don't know..

xxx44yyy avatar Oct 17 '18 18:10 xxx44yyy

What info do I get from you? Here I am using and running all ad methods.

diegoestacho999 avatar Oct 17 '18 19:10 diegoestacho999

By the tests I've done so far, in the emulator only test ads same. In the actual device everything okay, they exhibit all without problems. Try to use something like:

ionic cordova run android --prod

diegoestacho999 avatar Oct 17 '18 19:10 diegoestacho999

Hello @yacinknn @xxx44yyy you guys are life savers thank you. I was wondering where in config.xml you add "cordova-admob-sdk": "0.20.0" in the tags? Thank you much

darkthsideous avatar Oct 18 '18 00:10 darkthsideous

@darkthsideous not config.xml. In package.json. It's mine:

{
    "name": "cordovaads",
    "displayName": "CordovaAds",
    "version": "1.0.0",
    "description": "A sample cordova app for testing ads.",
    "main": "index.js",
    "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
    },
    "dependencies": {
        "cordova-admob-sdk": "0.20.0",
        "cordova-android": "^7.1.1",
        "cordova-browser": "^5.0.4",
        "cordova-ios": "^4.5.5",
        "cordova-plugin-admob-free": "^0.21.0",
        "cordova-plugin-whitelist": "^1.3.3",
        "cordova-promise-polyfill": "0.0.2"
    },
    "cordova": {
        "plugins": {
            "cordova-plugin-whitelist": {},
            "cordova-plugin-admob-free": {
                "ADMOB_APP_ID": "ca-app-pub-XXXXXXXXXXX~YYYYYYYYYYY"
            }
        },
        "platforms": [
            "ios",
            "android",
            "browser"
        ]
    }
}

And config.xml:

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.xxxx.yyyy.package.app" version="1.0.0" xmlns="http://www.w3.org/ns/widgets">
    <name>CordovaAds</name>
    <description>A sample cordova app for testing ads.</description>
    <content src="index.html" />
    <plugin name="cordova-plugin-whitelist" spec="1" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <platform name="android">
        <allow-intent href="market:*" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
    </platform>
    <plugin name="cordova-plugin-admob-free" spec="0.21.0">
        <variable name="ADMOB_APP_ID" value="ca-app-pub-XXXXXXXXX~YYYYYYYYY" />
    </plugin>
    <plugin name="cordova-admob-sdk" spec="../plugins/cordova-admob-sdk">
        <variable name="PLAY_SERVICES_VERSION" value="+" />
    </plugin>
    <preference name="fullscreen" value="true" />
    <preference name="show-splash-screen-spinner" value="false" />
    <engine name="ios" spec="^4.5.5" />
    <engine name="android" spec="^7.1.1" />
    <engine name="browser" spec="^5.0.4" />
</widget>

xxx44yyy avatar Oct 18 '18 01:10 xxx44yyy