aliokan / cordova-plugin-admob Goto Github PK
View Code? Open in Web Editor NEWAdMob Phonegap Plugin for Android and iOS
License: MIT License
AdMob Phonegap Plugin for Android and iOS
License: MIT License
Hi,
Is there any way to position the adview on top of the webview instead of resizing it?
webView.addView(adView) does this but I can't then position the ad to the bottom or align it centrally.
Is there a way to show / hide the ad after the ad is successfully served?
For example I want the ad to show in certain pages only and in some pages I want it to be hidden.
I suppose calling the killAd function is not the same, right?
I did try it on iOS 6 and iOS 7 (Cordova 3.3) but the killAd function does not seem to work.
I'm getting the following error on archive, I believe the AdMob SDK may need to be upgraded in the plugin.
Undefined symbols for architecture arm64:
"OBJC_CLASS$_GADAdMobExtras", referenced from:
objc-class-ref in AdMobPlugin.o
"_kGADAdSizeFullBanner", referenced from:
-[AdMobPlugin GADAdSizeFromString:] in AdMobPlugin.o
"OBJC_CLASS$_GADRequest", referenced from:
objc-class-ref in AdMobPlugin.o
"OBJC_CLASS$_GADInterstitial", referenced from:
objc-class-ref in AdMobPlugin.o
"OBJC_CLASS$_GADBannerView", referenced from:
objc-class-ref in AdMobPlugin.o
"_kGADAdSizeSmartBannerLandscape", referenced from:
-[AdMobPlugin GADAdSizeFromString:] in AdMobPlugin.o
-[AdMobPlugin resizeViews] in AdMobPlugin.o
"_kGADAdSizeLeaderboard", referenced from:
-[AdMobPlugin GADAdSizeFromString:] in AdMobPlugin.o
"_kGADAdSizeBanner", referenced from:
-[AdMobPlugin GADAdSizeFromString:] in AdMobPlugin.o
"_kGADAdSizeInvalid", referenced from:
-[AdMobPlugin createBannerView:] in AdMobPlugin.o
-[AdMobPlugin GADAdSizeFromString:] in AdMobPlugin.o
"_kGADAdSizeSmartBannerPortrait", referenced from:
-[AdMobPlugin GADAdSizeFromString:] in AdMobPlugin.o
-[AdMobPlugin resizeViews] in AdMobPlugin.o
"_kGADAdSizeMediumRectangle", referenced from:
-[AdMobPlugin GADAdSizeFromString:] in AdMobPlugin.o
"_GADAdSizeEqualToSize", referenced from:
-[AdMobPlugin createBannerView:] in AdMobPlugin.o
-[AdMobPlugin resizeViews] in AdMobPlugin.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
When I start ads, the screen often flickers
Any idea what could be causing this?
Hi,
I'm trying to implement this plugin on my 1st phone gap app but without succeeded.
I put the AdMobPlugin.js script on root directory and also add reference in page after the cordova.js reference, also I put the AdMobPlugin.java file in com\google\cordova\plugin folder and put the content of plugin.xml in pluginS.xml in res\xml folder.
I build the app with phonegap 2.9 and everything is OK.
when I run it on my device I got "class not found" error message from the failure function
I found that is occurred after cordova.exec.
Did I miss something, please advise!
thanks
I am not sure how to implement it. It would be better if there is a working example.
I would love to see that plugin on phonegap build. Any chance that it will be submit there?
import com.google.ads.* has changed to import com.google.android.gms.ads.*
Changes are not too drastic. I got it working. Here is the migration guide:
https://developers.google.com/mobile-ads-sdk/docs/admob/play-migration
Can we get this plugin available in PhoneGap build?
Regards,
Aliaks
I am trying to integrate this Plugin into an app created with Sencha Touch 2.4, but it doesn't seem to display anything....any ideas how to get this working?
This is what I found so far. But nothing happens
listeners: {
painted: function ( me, eOpts ) {
setTimeout(function() {
var success = function() {
admob.requestAd({
'isTesting': false,
'extras': {
'color_bg': 'AAAAFF',
'color_bg_top': 'FFFFFF',
'color_border': 'FFFFFF',
'color_link': '000080',
'color_text': '808080',
'color_url': '008000'
}
},
successCallback,
failureCallback
);
};
var error = function(message) {
alert('Error');
};
var successCallback = function(el) {
alert(el);
alert('successCallback');
};
var failureCallback = function() {
alert('failureCallback');
};
var options = {
'publisherId': 'ca-app-pub-****************/********** ',
'adSize': admob.AD_SIZE.BANNER
}
admob.createInterstitialView(options, success, error);
//admob.createBannerView(options, success, error);
}, 2000);
}
}
}
Hello !
App crash with android JellyBeen,
After onReceiveAd(), app return "
01-04 17:30:20.000: A/libc(4488): Fatal signal 11 (SIGSEGV) at 0x00000008 (code=1), thread 4488 (.cosmix.grawler)"
the problem is caused by an hardware acceleration issue, which can be solved turning hardwareAccelerated to false into AndroidManifest,
but doing this the app graphics quality highly decrease,
is there any solution, like only target the admob plugin hardware acceleration ?
trying to doing it into AndroidManifest activity doesn't work.
Regards,
thanks for this great plugin! i got banner ads and interstitial ads working separately, however if i put both of them together interstateial will refresh banner, instead of load full screen ads. any suggestions would be greatly appreciated! thank you.
Looks like there is an issue with the way this plugin moves and resizes webView. In iOS 7 status bar covers the top of main view. You can change this behaviour using this plugin 'com.phonegap.plugin.statusbar' (move webView down 20px), but this plugin after initialization moves webView back to top.
Looks like by changing the following code:
// Move the webview to the top of the screen.
webViewFrame.origin.y = 0;
...
webViewFrame.size.height = superViewFrame.size.height - bannerViewFrame.size.height;
To:
// Move the webview to the top of the screen.
if ([[UIDevice currentDevice].systemVersion floatValue] >= 7)
webViewFrame.origin.y = 20;
else
webViewFrame.origin.y = 0;
...
webViewFrame.size.height = superViewFrame.size.height - webViewFrame.origin.y - bannerViewFrame.size.height;
Resolves the issue, but I'm not sure what else it can break.
I have implemented this plugin in a game I am developing, when I run the game from with the emulator included in the adt it serves test adverts. However when deploying the debug apk to my nexus 4 for testing it serves non-testing adverts. This is a little concerning as it can result in banning from admob.
I have ensured that the admob.requestAd
method is passed the value of true
to the isTesting
property.
Google has insisted that phonegap/cordova applications be upgraded to version 3.5. Not as easy as it sounds by the way. Had to upgrade eclipse, etc. After installing the plugin, it does not appear in the src packages folder in eclipse. Is this plugin supported in version 3.5? Thanks.
Hey, here is my code. It works nicely on Android but it doesn't work on iOS. In the Xcode emulator I have a white empty banner, on an iPhone 3 device, nothing happens at all.
var admob_ios_key = 'ca-app-pub-6068517762438360/4083177731';
var admob_android_key = 'ca-app-pub-6068517762438360/7720118534';
var adId = (navigator.userAgent.indexOf('Android') >=0) ? admob_android_key : admob_ios_key;
admob.createBannerView(
{
'publisherId': adId,
'adSize': admob.AD_SIZE.BANNER
},
function(){
admob.requestAd(
{
'isTesting': false,
'extras': {
'color_bg': 'AAAAFF',
'color_bg_top': 'FFFFFF',
'color_border': 'FFFFFF',
'color_link': '000080',
'color_text': '808080',
'color_url': '008000'
},
},
function(){
},
function(){
alert("request error");
}
);
},
function(){
alert("create error")
}
);
Any idea what's going on ?
Can't show admob.There's no example,so I created by myself.But nothing displays.
Tested on iPhone 5 and iPad 4.
In config.xml :
<feature name="AdMobPlugin"> <param name="ios-package" value="AdMobPlugin" /> </feature>
In index.html
<body onload="onLoad()">
<script>
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
function onDeviceReady() {
var admob_ios_key = 'a151e6d43c5a28f';
var admob_android_key = 'a151e6d65b12438';
var adId = (navigator.userAgent.indexOf('Android') >=0) ? admob_android_key : admob_ios_key;
if ( window.plugins && window.plugins.AdMobPlugin ) {
} else {
alert('AdMobPlugin plugin not available/ready.');
}
var am = window.plugins.AdMobPlugin;
am.createBannerView(
{
'publisherId': adId,
'adSize': am.AD_SIZE.BANNER,
'bannerAtTop': true
}, function() {
am.requestAd( { 'isTesting':false }, function() {
am.showAd( true );
}, function() {
alert('failed to request ad');
})
}, function(){
alert( "failed to create ad view" );
});
}
</script>
The "alert('AdMobPlugin plugin not available/ready.');" alerts every time, although I've added plugin sources into work project.
Hello!
Can you please add this as a plugin to phonegap build?
https://build.phonegap.com/plugins
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.