AdMob - 检查应用是否已被停用

时间:2017-04-06 08:32:10

标签: android admob google-admob

我想知道是否有办法检查我的应用是否已停用,以便从AdMob投放广告。我在谷歌Play商店发布了一个旧应用程序,它曾经在其上刊登广告,现在我又开始使用该应用程序而且我一直在尝试再次添加AdMob而结果不成功。尝试在真实设备上投放广告时出现以下错误。

注意:如果我将真实设备添加为测试设备,测试广告会正确显示,测试广告也会在模拟器中正确显示。

There was a problem getting an ad response. ErrorCode: 0
Failed to load ad: 0

我一直在寻找互联网上的几个主题的解决方案,其中一些建议我的应用已被停用以从AdMob投放广告,我应该收到一封包含相关信息的电子邮件,此应用程序无人值守几个月所以我可能丢失了那封电子邮件,我们是否有办法从AdMob控制台检查特定应用的状态?

注意:我的帐户状态为“打开”状态。在AdMob控制台中。

这是我的app当前依赖项和代码,如果有帮助:

Gradle依赖项:

...
compile 'com.firebaseui:firebase-ui:1.2.0'
compile 'com.jakewharton:butterknife:8.5.1'
compile 'com.github.jkwiecien:EasyImage:1.3.1'
compile 'com.android.support:cardview-v7:25.2.0'
compile 'com.google.firebase:firebase-ads:10.2.0'
compile 'com.google.firebase:firebase-crash:10.2.0'
...

LoginActivity.java

...
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    MobileAds.initialize(this, "ca-app-pub-X~Y");
...

MainFragment.java

...

    AdView mAdView = (AdView) view.findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder().build();
    mAdView.loadAd(adRequest);
...

fragment_main.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/content_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"

android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.x.y.MainActivity"

android:background="@color/tw__composer_deep_gray">


<android.support.v7.widget.CardView
    android:id="@+id/titleCardView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_marginLeft="@dimen/activity_horizontal_margin"
    android:layout_marginRight="@dimen/activity_horizontal_margin"
    android:layout_marginBottom="10dp">

    <TextView
        android:text="TextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/usernameTitle"
        android:layout_margin="10dp" />
</android.support.v7.widget.CardView>

<android.support.v7.widget.CardView
    android:id="@+id/imageCardView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/titleCardView"
    android:layout_above="@+id/adView"
    android:layout_marginLeft="@dimen/activity_horizontal_margin"
    android:layout_marginRight="@dimen/activity_horizontal_margin"
    android:layout_marginBottom="10dp">

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:srcCompat="@drawable/com_facebook_button_background"
        android:id="@+id/profileImage"
        android:layout_gravity="center_vertical|center_horizontal" />
</android.support.v7.widget.CardView>


<com.google.android.gms.ads.AdView
    android:id="@+id/adView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_alignParentBottom="true"
    ads:adSize="BANNER"
    ads:adUnitId="@string/banner_ad_unit_id">
</com.google.android.gms.ads.AdView>
</RelativeLayout>

2 个答案:

答案 0 :(得分:0)

如果您刚刚创建了AdMob广告单元,则必须等待几个小时才能使用它。

或者您刚刚添加了错误的广告ID。

答案 1 :(得分:0)

根据this official Google document,错误代码0代表:

<块引用>
Error Code 0 : ERROR_CODE_INTERNAL_ERROR

这表明内部发生了一些事情;例如,收到来自广告服务器的无效响应。

新创建的广告单元最多可能需要 2 小时才能激活(启动时间)。来自新创建的广告单元的任何广告请求也会收到错误代码 0 以响应广告请求,直到它们准备好投放实时广告为止。

怎么办?测试广告!!

相关问题