I'm using this plugin with my phonegap/cordova (version 3.4) android app: https://github.com/floatinghotpot/cordova-plugin-admob
Recently (8 days ago) I noted that the autor updated to the new google play service sdk instead of the old admob sdk, so I'm trying to use this new sdk. I already installed the lib to my project and all is working and compiling. But when I run the plugin example code, or just this:
window.plugins.AdMob.createBannerView( { 'publisherId' : '...............', 'adSize' : am.AD_SIZE.BANNER, 'bannerAtTop' : true }, function() {}, function() {} );
The app crashes with this error: "03-06 20:40:20.063: A/libc(6949): Fatal signal 6 (SIGABRT) at 0x00000223 (code=0), thread 6949"
If i just remove that function the page loads well.. Anyone knows what's happening or already get it working with the new sdk?
EDIT: I decided to do myself without plugins. This code works and the ads is already showing. Does this seem correct and its all that is needed to new framework?
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
super.init();
// Set by <content src="index.html" /> in config.xml
super.loadUrl(Config.getStartUrl());
//super.loadUrl("file:///android_asset/www/index.html")
// Set ad settings
adView = new AdView(this);
adView.setAdUnitId(AD_UNIT_ID);
adView.setAdSize(AdSize.SMART_BANNER);
// Layout
LinearLayout layout = super.root;
layout.addView(adView);
// Request and show ad
AdRequest request = new AdRequest.Builder().build();
adView.loadAd(request);
}
@Override
public void onResume() {
super.onResume();
if (adView != null) {
adView.resume();
}
}
@Override
public void onPause() {
if (adView != null) {
adView.pause();
}
super.onPause();
}
/** Called before the activity is destroyed. */
@Override
public void onDestroy() {
// Destroy the AdView.
if (adView != null) {
adView.destroy();
}
super.onDestroy();
}
}
Here's a solution:
Install the plugin you referred: https://github.com/floatinghotpot/cordova-plugin-admob.git
Use Cordova 3.3 or 3.5+, as known, v3.4 has some defects fixed in 3.5
Source: https://stackoverflow.com/questions/22647417/admob-plugins-compatible-with-phonegap-3-4
User contributions licensed under CC BY-SA 3.0