我在Android工作室使用了Android Admob SDK。我的测试横幅广告在我的应用中正确显示。我在这里使用了来自developer document的广告单元ID。
在Google Play上发布alpha版(或)产品发布之前,我需要做的其他重点吗?
我已粘贴下面的代码供参考。
MainActivity.java
public class MainActivity extends BaseActivity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
AdView eAdView= (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
eAdView.loadAd(adRequest);
}
}
activity_main.xml中
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adSize="SMART_BANNER"
ads:adUnitId="@string/banner_ad_unit_id"
android:layout_marginTop="?attr/actionBarSize"
/>
...
...
<FrameLayout>
的strings.xml
<string name="banner_ad_unit_id">ca-app-pub-3940256099942544/6300978111</string>
答案 0 :(得分:0)
你应该