Is there any AdMob dummy id?

匿名 (未验证) 提交于 2019-12-03 02:14:01

问题:

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

回答1:

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



回答2:

This is the dummy id for Banner ads.

ca-app-pub-3940256099942544/6300978111

source



回答3:

Banner:

ca-app-pub-3940256099942544/6300978111

Interstitial:

ca-app-pub-3940256099942544/1033173712

Rewarded Video:

ca-app-pub-3940256099942544/5224354917

Native Advanced:

ca-app-pub-3940256099942544/2247696110

Native Express Small/Large:

ca-app-pub-3940256099942544/2793859312  ca-app-pub-3940256099942544/2177258514

source



回答4:

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



回答5:

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:



回答6:

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>


回答7:

For RewardedVideo you can use the following one :

private static final String AD_UNIT_ID = "ca-app-pub-3940256099942544/5224354917"; private static final String APP_ID = "ca-app-pub-3940256099942544~3347511713";

how to use:

MobileAds.initialize(this, APP_ID);  mRewardedVideoAd = MobileAds.getRewardedVideoAdInstance(this); mRewardedVideoAd.setRewardedVideoAdListener(this); mRewardedVideoAd.loadAd(AD_UNIT_ID, new AdRequest.Builder().build());

for showing

 if (mRewardedVideoAd.isLoaded()) {         mRewardedVideoAd.show();   }

Hope this will help many of us!



转载请标明出处:Is there any AdMob dummy id?
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!