How do integrate Admob ad my phonegap android app?

2,342 views
Skip to first unread message

Kemal Çimen

unread,
Oct 13, 2012, 7:38:02 AM10/13/12
to phon...@googlegroups.com
I try lot of way but every guide or tutorial tell another way and code.Please can anyone sendme expamle file or full solution.I need.

Best Regards,

Khushwant Singh

unread,
Oct 13, 2012, 8:17:43 AM10/13/12
to phon...@googlegroups.com
Hi,

Have you tried this link...


I myself have followed this and have successfully implemented Google Admob in my phonegap app.

Thanks,
Khushwant Singh




On Sat, Oct 13, 2012 at 1:38 PM, Kemal Çimen <hasci...@gmail.com> wrote:
I try lot of way but every guide or tutorial tell another way and code.Please can anyone sendme expamle file or full solution.I need.

Best Regards,

--
-- You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to
phonegap+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en
 
For more info on PhoneGap or to download the code go to www.phonegap.com
 
To compile in the cloud, check out build.phonegap.com
 
 

Kemal Çimen

unread,
Oct 13, 2012, 8:37:13 AM10/13/12
to phon...@googlegroups.com
Hımm.I've already tried but ı get error every step :/ it dosent work. ı can try again.You have done it.İs there any point you know without introduction link?

13 Ekim 2012 Cumartesi 15:17:56 UTC+3 tarihinde Khushwant Singh yazdı:

Khushwant Singh

unread,
Oct 13, 2012, 1:26:16 PM10/13/12
to phon...@googlegroups.com
Ok,

Please follow below mentioned..

in the libs folder paste - GoogleAdMobAdsSdk-6.1.0.jar

in the project properties..android-   javabuildpath. "Add Jar"  GoogleAdMobAdsSdk-6.1.0.jar

Select "order and export" tab and check GoogleAdMobAdsSdk-6.1.0.jar

in the androidmanifest.xml
        <activity android:name="com.google.ads.AdActivity"
              android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>

in your main java file after super.loadurl

adView = new AdView(this, AdSize.BANNER, AdMob_Ad_Unit);
        LinearLayout layout = super.root;
        layout.addView(adView); 
        AdRequest request = new AdRequest();
        adView.loadAd(request);

//AdMob_Ad_Unit = user id that you have got from admob
        

Also don't forget to set build target to 3.2 from "properties->android"


I hope this will help you.

Thanks,
Khushwant Singh

Kemal Çimen

unread,
Oct 14, 2012, 1:07:09 AM10/14/12
to phon...@googlegroups.com
Thanks So much.I've tried your introductions step by step.Though ı turned it Android 3.2 (API level:13) I get two error.Please check it out below.How do ı solve this?

http://dl.dropbox.com/u/37434656/error.JPG

Best Regards,

13 Ekim 2012 Cumartesi 20:26:31 UTC+3 tarihinde Khushwant Singh yazdı:

Khushwant Singh

unread,
Oct 14, 2012, 6:31:20 AM10/14/12
to phon...@googlegroups.com

Hi,

Please review your code....  The id should be in double quotes or use static variable that u have declared before...

Thanks,
Khushwant singh

Kemal Çimen

unread,
Oct 15, 2012, 12:59:11 AM10/15/12
to phon...@googlegroups.com
@ Khushwant Singh Thanks so much ı've solved all problem.as you said.the id should be in double quotes.Thanks again.
@wannabe
Thanks so much.I check out your link and ı realized how ı write activity code in manifest.

Thanks again. :)

Best Regards,

sheheer vm

unread,
Feb 19, 2014, 5:11:12 AM2/19/14
to phon...@googlegroups.com
/*
       Licensed to the Apache Software Foundation (ASF) under one
       or more contributor license agreements.  See the NOTICE file
       distributed with this work for additional information
       regarding copyright ownership.  The ASF licenses this file
       to you under the Apache License, Version 2.0 (the
       "License"); you may not use this file except in compliance
       with the License.  You may obtain a copy of the License at


       Unless required by applicable law or agreed to in writing,
       software distributed under the License is distributed on an
       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
       KIND, either express or implied.  See the License for the
       specific language governing permissions and limitations
       under the License.
 */

package com.aitrich.geo;
import android.os.Bundle;
import android.widget.LinearLayout; 
import com.google.ads.*;
import org.apache.cordova.*;
public class geolocation1 extends CordovaActivity 
{
private static final String AdMob_Ad_Unit = "admobid";
private AdView adView; 
 
   
@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")
        adView = new AdView(this, AdSize.BANNER, AdMob_Ad_Unit); 
        LinearLayout layout = super.root;
        layout.addView(adView); 
        AdRequest request = new AdRequest();
        request.setTesting(true);
        adView.loadAd(request); 

Abdullah Al Mahamud

unread,
Feb 23, 2014, 11:31:59 PM2/23/14
to phon...@googlegroups.com
How To Admob Native Android SDK Integration with Phonegap/Cordova in android studio


http://androidstudiodevelop.blogspot.com/2014/02/how-to-admob-native-android-sdk.html

Rahul

unread,
Feb 24, 2014, 10:37:33 AM2/24/14
to phon...@googlegroups.com


On Saturday, October 13, 2012 5:08:02 PM UTC+5:30, Hasan Çimen wrote:

Rjfun Mobile

unread,
Aug 26, 2014, 2:56:26 AM8/26/14
to phon...@googlegroups.com
There are some mature and good cordova plugins to show admob banner or interstitial ad.

For example:

Sample code:

Step 1: Prepare your AdMob Ad Unit Id for your banner and interstitial

var ad_units = {
    ios : {
        banner: 'ca-app-pub-xxx/xxx',
        interstitial: 'ca-app-pub-xxx/xxx'
    },
    android : {
        banner: 'ca-app-pub-xxx/9375997553',
        interstitial: 'ca-app-pub-xxx/xxx'
    }
};
// select the right Ad Id according to platform
var admobid = ( /(android)/i.test(navigator.userAgent) ) ? ad_units.android : ad_units.ios;

Step 2: Create a banner with single line of javascript

// it will display smart banner at top center, using the default options
if(AdMob) AdMob.createBanner( admobid.banner );

// or, show a banner at bottom
if(AdMob) AdMob.createBanner( {
    adId:admobid.banner, 
    position:AdMob.AD_POSITION.BOTTOM_CENTER, 
    autoShow:true} );

Step 3: Prepare an interstitial, and show it when needed

// preppare and load ad resource in background, e.g. at begining of game level
if(AdMob) AdMob.prepareInterstitial( {adId:admobid.interstitial, autoShow:false} );

// show the interstitial later, e.g. at end of game level
if(AdMob) AdMob.showInterstitial();
Reply all
Reply to author
Forward
0 new messages