gpt4 book ai didi

android - Admob 印象/点击在 playstore 上传后不更新

转载 作者:太空狗 更新时间:2023-10-29 14:55:45 25 4
gpt4 key购买 nike

我使用 this link 创建了横幅 admob 广告.应用程序运行良好。我什至获得了发布者 ID,并且能够从 Admob 网站查看展示次数和点击次数。但在我完成开发后,我将应用程序上传到 Play 商店,但我无法从 Admob 网站查看任何广告印象/点击,尽管广告显示在从 PlayStore 下载的应用程序中。尽管只要我在测试设备上查看它,就会显示展示次数/点击次数。但是如果我从 google playstore 下载并使用它,则没有印象/点击会更新。我已经从 Playstore 链接了该应用程序。大约有 50 人下载了该应用程序,已经 3 天了,但展示次数/点击次数没有更新。现在我需要做什么才能跟踪展示次数或点击次数。我需要获取新的发布商 ID 吗?如果是这样,获得它的步骤是什么。提前致谢。帮助我,我是 admob 的新手。

我在要展示广告的 Activity 中使用此代码

import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
.
.
AdView mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);

在 android list 文件中

        <meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
.
.
.
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />

在strings.xml文件中

<string name="banner_ad_unit_id">ca-app-pub-3**************3/*********7</string>

在 Activity xml 中,我使用了以下代码

 <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="@string/banner_ad_unit_id">
</com.google.android.gms.ads.AdView>

此外,我使用了两个不同的电子邮件 ID,一个用于 admob 的电子邮件 ID 与我从中上传应用程序的 Play 商店 ID 不同。这是 admob 屏幕截图的链接。

http://postimg.org/image/kh26x3oyh/

最佳答案

Note: Ads can only be shown to the user, if they are available from the ad network.

  1. 您是否定义了这两种权限?

    < 使用权限 android:name="android.permission.INTERNET"/>

    < 使用权限 android:name="android.permission.ACCESS_NETWORK_STATE"/>

  2. 确保横幅添加单元不是测试。

  3. 添加一个监听器以查看是否正在加载添加:

    mAdView = (AdView) findViewById(R.id.adView);
    mAdView.setAdListener(new AdListener() {
    // Called when an ad is loaded.
    @Override
    public void onAdLoaded() {
    Log.e(TAG, "Google onAdLoaded");
    }

    // Called when an ad failed to load.
    @Override
    public void onAdFailedToLoad(int error) {
    String message = "Google onAdFailedToLoad: " + getErrorReason(error);
    Log.e(TAG, message);
    }

    // Called when an Activity is created in front of the app
    // (e.g. an interstitial is shown, or an ad is clicked and launches a new Activity).
    @Override
    public void onAdOpened() {
    Log.e(TAG, "Google onAdOpened");
    }

    // Called when an ad is clicked and about to return to the application.
    @Override
    public void onAdClosed() {
    Log.e(TAG, "Google onAdClosed");
    }

    // Called when an ad is clicked and going to start a new Activity that will leave the application
    // (e.g. breaking out to the Browser or Maps application).
    @Override
    public void onAdLeftApplication() {
    Log.d(TAG, "Google onAdLeftApplication");
    }
    });
    AdRequest adRequest = new AdRequest.Builder().build();
    mAdView.loadAd(adRequest);

你还需要这个功能:

private String getErrorReason(int errorCode) {
// Gets a string error reason from an error code.
String errorReason = "";
switch (errorCode) {
case AdRequest.ERROR_CODE_INTERNAL_ERROR:
errorReason = "Internal error";
break;
case AdRequest.ERROR_CODE_INVALID_REQUEST:
errorReason = "Invalid request";
break;
case AdRequest.ERROR_CODE_NETWORK_ERROR:
errorReason = "Network Error";
break;
case AdRequest.ERROR_CODE_NO_FILL:
errorReason = "No fill";
break;
}
return errorReason;
}

关于android - Admob 印象/点击在 playstore 上传后不更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31640814/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com