适用于Google Play的Android Admob SDK AdUnitID版本

时间:2015-07-23 17:30:58

标签: android admob adsense

我在Android工作室使用了Android Admob SDK。我的测试横幅广告在我的应用中正确显示。我在这里使用了来自developer document的广告单元ID。

  1. 当我在Google Play alpha版本上发布应用时,我可以使用相同的AdUnitID吗?
  2. 在Google Play制作发布时发布应用时,我可以使用相同的AdUnitID吗?
  3. 我仍然没有创建AdMob帐户(或)Adsense帐户。 只有我在Google Play上注册时创建了Google钱包帐户。 我需要创建Admob帐户以及Adsense帐户吗?或者,电子钱包帐户足以在我的帐户中存入信用。
  4. 我已经在我的应用上添加了智能横幅广告,根据展示次数或需要触摸广告,我会在此基础上将资金归功于我。
  5. 在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>
    

1 个答案:

答案 0 :(得分:0)

你应该

  1. 创建Admob帐户
  2. 创建Admob AdUnit并获取其ID
  3. 在您的应用中使用(2)中的ID。