ratson / cordova-plugin-admob-free

New development has been moved to "admob-plus-cordova", https://github.com/admob-plus/admob-plus/tree/master/packages/cordova
https://github.com/admob-plus/admob-plus
MIT License
499 stars 214 forks source link

Not showing in real device #307

Open xxx44yyy opened 5 years ago

xxx44yyy commented 5 years ago

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?

ConcaveIT commented 5 years ago

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

Winamp9 commented 5 years ago

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

ConcaveIT commented 5 years ago

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

xxx44yyy commented 5 years ago

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 commented 5 years ago

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

ConcaveIT commented 5 years ago

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

xxx44yyy commented 5 years ago

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

ConcaveIT commented 5 years ago

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)

xxx44yyy commented 5 years ago

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 commented 5 years ago

@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.

ConcaveIT commented 5 years ago

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

xxx44yyy commented 5 years ago

To see real advertising - apparently Yes.

yacinknn commented 5 years ago

"cordova-admob-sdk": "0.20.0"

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

ConcaveIT commented 5 years ago

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

yacinknn commented 5 years ago

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

ConcaveIT commented 5 years ago

@Yacinknn, can you share your code?

xxx44yyy commented 5 years ago

@yacinknn

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

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() })

ConcaveIT commented 5 years ago

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

yacinknn commented 5 years ago

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

ConcaveIT commented 5 years ago

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

xxx44yyy commented 5 years ago

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

ConcaveIT commented 5 years ago

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

xxx44yyy commented 5 years ago

@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)

ConcaveIT commented 5 years ago

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

xxx44yyy commented 5 years ago

I don't know..

diegoestacho999 commented 5 years ago

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

diegoestacho999 commented 5 years ago

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

darkthsideous commented 5 years ago

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

xxx44yyy commented 5 years ago

@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>
darkthsideous commented 5 years ago

@xxx44yyy oh! that makes perfect sense. Thank you so much

yacinknn commented 5 years ago

thank u darkthsideous i ask a question about admob if i use interstitial auto Show =true is it legal for admob . i afraid that i will be banned from admob if i use it !!

darkthsideous commented 5 years ago

@yacinknn sorry for late reply. I dont believe you will get banned i think it only records how many times you use interstitial per impression to avoid spamming. I use autoshow= true, after a certain page in my app loads. i havent had any problems yet

yacinknn commented 5 years ago

@yacinknn sorry for late reply. I dont believe you will get banned i think it only records how many times you use interstitial per impression to avoid spamming. I use autoshow= true, after a certain page in my app loads. i havent had any problems yet

bro the problem of autoshow = true is showing interstitial ads after every seconds , and this is not allowed in terms of admob ( i have exeperience with this issue ) , can u tell me how to use autoshow= true, after a certain page in ur app loads.? thank u very much bro

darkthsideous commented 5 years ago

Yeah that is definitely not allowed for it to continuously show.

i usually just have my generic launch interstitial function and call it in ionVIewDidLoad

`launchInterstitial() {

let interstitialConfig: AdMobFreeInterstitialConfig = {
  autoShow: true,
  id: 'ca-app-pub-AD-Mob-ID'
};

this.admob.interstitial.config(interstitialConfig);

this.admob.interstitial.prepare().then(() => {
  // success
});

}`

darkthsideous commented 5 years ago

@xxx44yyy i tried your fix same issue occurring for me. Basically my ads are not showing at not a blank banner just completely gone as if it didn't launch at all. however it is launching in my console.log thoughts?

xxx44yyy commented 5 years ago

@darkthsideous I think you should create a new issue.

darkthsideous commented 5 years ago

@xxx44yyy ugh that bad. ok i will thank you. Just to confirm what version of the plugin are you using. Also have you tried admob-plus

satyam-dev commented 5 years ago

Anyone found a solution? Man o man I've tried everything from cleaning the cache to removing platforms and reinstalling them, deleting the node modules, deleting plugins folder, re adding all of them. Nothing works!! On real device it does not work and while I test it on DevsApp, it works damn smooth with all the banner and Interstitial ads! Please help

ghost commented 5 years ago

@xxx44yyy please I have done everything but it's still nothing display anything, could it be that I am not getting the javascript code? If yes, please how will the javascript be like and where will I place it? I am using visual studio 2017

darkthsideous commented 5 years ago

@EricChuddy have you seen anymore active issues. Im afraid you might be facing a different issue

joy2012bd commented 5 years ago

To see real advertising - apparently Yes.

When I set isTesing:true; ads is showing in real device.But if I set it false or comment out like // isTesing: true; ads is not showing. Do I Need to Publish It in Play Store? Otherwise ads won't be showing?

ghost commented 5 years ago

@darkthsideous It shows me error when I try to build

mayekarakshay24 commented 4 years ago

@xxx44yyy ads are not shown when i tried to create app with cordova.i even created app with phonegap still it is not working. can u plz help i dont understand whats the problem.if this issue i solved it will be great help from u

saggittarium commented 4 years ago

If you want to debug your setup for android, this may help:

You will find Java lib source: platforms\android\app\src\main\java\name\ratson\cordova\admob\Admob.java try adding some logs/flags and track them in the logcat logs.

Also: https://stackoverflow.com/questions/45069642/why-remove-admobs-addtestdevice-in-production

Cheers