Reputation: 409
I have integrated AdMob in my application like this.
#define AdMob_ID @"a14fd99963270b2"
-(void)viewDidLoad
{
[super viewDidLoad];
GADBannerView *admob = [[GADBannerView alloc] initWithFrame:CGRectMake(0, 360, 320, 50)];
admob.adUnitID = AdMob_ID;
admob.rootViewController=self;
[self.view addSubview:admob];
GADRequest *req=[[GADRequest alloc] init];
req.testing=YES;
[admob loadRequest:req];
}
This is giving me be by default google,
If i change AdMob_ID to my application's id then add is not shown.
What can be issue?
At the time of creating AdMobID it is asking for the iTunes connect application link.
This link can be obtained after the application gets online.
Thanks in advance.
Upvotes: 0
Views: 405
Reputation: 107
In AdMob integration with your application you need to make changes in your Gradle, Manifest and the activity where you want the ad to be displayed. Give the user permissions as required. Check this out.
activity_main.xml
xmlns:ads="http://schemas.android.com/apk/res-auto"
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="@string/banner_ad_unit_id">
</com.google.android.gms.ads.AdView>
Strings.xml
<string name="banner_ad_unit_id">ca-app-pub-your id</string>
MainActivity.java
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
public class MainActivity extends ActionBarActivity {
..........
AdView mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
}
For further reference, here is an AdMob for Android tutorial.
Upvotes: 0
Reputation: 371
Are you sure that you aren't in test mode? Admob displays that image for testing purposes, good news is that your admob integration works. In order to serve live ads, make sure you aren't in test mode.
Upvotes: 2