我的应用程序最近已从谷歌播放中删除,再次提交后我注意到我从Admob无法获得任何收益,因此我尝试在我的测试设备上运行该应用程序,在每个人中我都让测试广告工作很棒,但当我尝试使用我的朋友手机检查他们是否可以看到广告(从谷歌播放下载的真实应用)时,我看不到广告,所以广告现在不适合我。这是我的代码:
XML
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
ads:adSize="BANNER"
ads:adUnitId="@string/banner_ad_unit_id"></com.google.android.gms.ads.AdView>
活动:
mAdView = (AdView) findViewById(R.id.adView);
AdRequest request = new AdRequest.Builder()
.addTestDevice("AdRequest.DEVICE_ID_EMULATOR")
.addTestDevice("207B846CF80A463F4B3150638CF7D2D0")
.addTestDevice("0C3A7B25110E565DF33D48DCFE71ED05")
.addTestDevice("49C6ED95F28B7F4413E2F118505A8B5B")
.addTestDevice("74049DAA476D3FA230CF6FDD6D35CDCC")
.build();
mAdView.loadAd(request);
Androidmanifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="clash.davidbalas.com.deckrandomizer_clashroyale">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@drawable/images"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity
android:name=".main2"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".main3"
android:label="@string/app_name"></activity>
<activity
android:name=".main4"
android:label="@string/app_name"></activity>
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
</application>
</manifest>
Admob最近与firebase集成,我必须在app中更改我的代码才能使用它?
Logcat:
07-08 20:03:33.481 22018-22018/com.clash.deckrandomizer I/Ads: Starting ad request.
07-08 20:03:33.481 22018-22018/com.clash.deckrandomizer I/Ads: Use AdRequest.Builder.addTestDevice("207B846CF80A463F4B3150638CF7D2D0") to get test ads on this device.
07-08 20:03:33.541 22018-22018/com.clash.deckrandomizer D/DynamitePackage: Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl
07-08 20:03:33.541 22018-22018/com.clash.deckrandomizer I/Ads: Starting ad request.
07-08 20:03:33.541 22018-22018/com.clash.deckrandomizer I/Ads: Use AdRequest.Builder.addTestDevice("207B846CF80A463F4B3150638CF7D2D0") to get test ads on this device.
07-08 20:03:33.721 22018-22029/com.clash.deckrandomizer W/Ads: There was a problem getting an ad response. ErrorCode: 0
07-08 20:03:33.721 22018-22018/com.clash.deckrandomizer W/Ads: Failed to load ad: 0
07-08 20:03:33.751 22018-22210/com.clash.deckrandomizer W/Ads: There was a problem getting an ad response. ErrorCode: 0
07-08 20:03:33.751 22018-22018/com.clash.deckrandomizer W/Ads: Failed to load ad: 0