Is there any AdMob dummy id?

前端 未结 8 1676
没有蜡笔的小新
没有蜡笔的小新 2020-12-13 06:39

Is there any AdMob dummy ids for testing purpose? Do I need to register app & get MY_AD_UNIT_ID?

相关标签:
8条回答
  • 2020-12-13 07:08

    OS: Android

    Mediation: Admob

    For Banner Ads:

    ca-app-pub-3940256099942544/6300978111
    

    Source

    For Interstitial Ads:

    ca-app-pub-3940256099942544/1033173712
    

    Source

    For Admob NativeExpress Ads:

    ca-app-pub-3940256099942544/1072772517
    

    For Rewarded Video

    ca-app-pub-3940256099942544/5224354917
    

    Note:

    The NativeExpressAd you'll see looks like a real one, but it's counted as a test ad. You're free to use that ad unit ID for your testing.

    by Andrew Brogdon (Google Ads Team in one of his youtube comments)

    All test Ads you can find in the actual admob github repository in the res > values > strings.xml

    0 讨论(0)
  • 2020-12-13 07:09

    Sample adMob by google

    <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="ca-app-pub-3940256099942544/6300978111">
    </com.google.android.gms.ads.AdView>
    
    0 讨论(0)
  • 2020-12-13 07:15

    Here is an official update from google

    Android

    • Banner: ca-app-pub-3940256099942544/6300978111
    • Interstitial : ca-app-pub-3940256099942544/1033173712
    • Reward Video: ca-app-pub-3940256099942544/5224354917
    • Native Advanced: ca-app-pub-3940256099942544/2247696110
    • Native Express (small): ca-app-pub-3940256099942544/2793859312
    • Native Express (large): ca-app-pub-3940256099942544/2177258514

    IOS

    • Banner:ca-app-pub-3940256099942544/6300978111

    • Interstitial ca-app-pub-3940256099942544/1033173712

    • Rewarded Video ca-app-pub-3940256099942544/1712485313

    • Native Advanced ca-app-pub-3940256099942544/2247696110

    • Native Express (Small): ca-app-pub-3940256099942544/4270592515

    • Native Express(Large): ca-app-pub-3940256099942544/8897359316

    Read more:

    • Android Test Ads on Firebase
    • IOS Test Ads on Firebase
    0 讨论(0)
  • 2020-12-13 07:20

    And sample app id for tests : ca-app-pub-3940256099942544~3347511713

    0 讨论(0)
  • 2020-12-13 07:24

    There aren't dummy ID's per se. You need to setup the XML or the JAVA code to get test ads. To get Test Ads during testing, add the following to your XML where you have the AdView declared.

    NOTE: I use just the XML code to display Ads in my app.

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="bottom|center"
        android:orientation="horizontal" >
    
        <com.google.ads.AdView
            android:id="@+id/adView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            ads:adSize="BANNER"
            ads:adUnitId="YOUR_AD_UNIT_ID"
            ads:loadAdOnCreate="true"
            ads:testDevices="TEST_EMULATOR, YOUR_DEVICE_ID" >
        </com.google.ads.AdView>
    </LinearLayout>
    

    To set the Test Unit (Both the emulator and your devices) from JAVA:

    AdRequest adRequest = new AdRequest();
    adRequest.addTestDevice(AdRequest.TEST_EMULATOR);            
    adRequest.addTestDevice("test");
    

    To get your Device ID, you can use this:

    final TelephonyManager tm = (TelephonyManager)getBaseContext().getSystemService(Context.TELEPHONY_SERVICE);
    String deviceid = tm.getDeviceId();
    

    From: https://stackoverflow.com/a/9681517/450534

    EDIT: Missed your second question.

    Yes. You will need to register your app in your Ad-Mob account. Without that being registered, you won't be getting your Ad Unit ID and therefore, no Ads in your app either.

    UPDATE: Approximately two years after posting this answer, Google added a few dummy ID's to their admob SDK. Please refer to the other better voted answers for the dummy ID's

    0 讨论(0)
  • 2020-12-13 07:25

    This is the dummy id for Banner ads.

    ca-app-pub-3940256099942544/6300978111

    source

    0 讨论(0)
提交回复
热议问题