为什么 AdWhirl 在我的 Android 应用程序中没有显示任何添加?

发布于 2024-11-14 21:05:25 字数 4118 浏览 2 评论 0原文

我刚刚将 adwhirl 集成到我的 Android 应用程序中。 现在我对如何确保广告显示在我的应用程序中有点困惑。

我激活了 admob 作为目前唯一的广告服务网络。 我的应用程序启动后,我得到以下日志输出:

06-10 14:03:08.007: INFO/AdWhirl SDK(4881): Creating adWhirlManager...
06-10 14:03:08.014: DEBUG/AdWhirl SDK(4881): Locale is: de_DE
06-10 14:03:08.014: DEBUG/AdWhirl SDK(4881): Hashed device ID is: ...
06-10 14:03:08.022: INFO/AdWhirl SDK(4881): Finished creating adWhirlManager
06-10 14:03:08.389: DEBUG/AdWhirl SDK(4881): Prefs{...}: {"config": "{"extra":{"location_on":0,"background_color_rgb":{"red":40,"green":53,"blue":98,"alpha":1},"text_color_rgb":{"red":255,"green":255,"blue":255,"alpha":1},"cycle_time":30,"transition":3},"rations":[{"nid":"706a61fa3ec446c7b016bfa9d39256d4","type":1,"nname":"admob","weight":100,"priority":1,"key":"a14deaa0ed3f8f6"}]}
06-10 14:03:08.389: DEBUG/AdWhirl SDK(4881): ", "timestamp": 1307707109720}
06-10 14:03:08.389: INFO/AdWhirl SDK(4881): Using stored config data
06-10 14:03:08.389: DEBUG/AdWhirl SDK(4881): Received jsonString: {"extra":{"location_on":0,"background_color_rgb":{"red":40,"green":53,"blue":98,"alpha":1},"text_color_rgb":{"red":255,"green":255,"blue":255,"alpha":1},"cycle_time":30,"transition":3},"rations":[{"nid":"706a61fa3ec446c7b016bfa9d39256d4","type":1,"nname":"admob","weight":100,"priority":1,"key":"a14deaa0ed3f8f6"}]}
06-10 14:03:08.600: INFO/AdWhirl SDK(4881): Rotating Ad
06-10 14:03:08.600: DEBUG/AdWhirl SDK(4881): Dart is <91.2614682720399> of <100.0>
06-10 14:03:08.921: DEBUG/AdWhirl SDK(4881): Showing ad:
06-10 14:03:08.921: DEBUG/AdWhirl SDK(4881):     nid: 706a61fa3ec446c7b016bfa9d39256d4
06-10 14:03:08.921: DEBUG/AdWhirl SDK(4881):     name: admob
06-10 14:03:08.921: DEBUG/AdWhirl SDK(4881):     type: 1
06-10 14:03:08.921: DEBUG/AdWhirl SDK(4881):     key: a14deaa0ed3f8f6
06-10 14:03:08.921: DEBUG/AdWhirl SDK(4881):     key2: 
06-10 14:03:08.936: DEBUG/AdWhirl SDK(4881): Valid adapter, calling handle()

Update 我还在日志中找到了这个

06-10 14:45:34.546: ERROR/Ads(6010): ACCESS_NETWORK_STATE permissions must be enabled in AndroidManifest.xml.
06-10 14:45:34.546: ERROR/Ads(6010): You must have INTERNET and ACCESS_NETWORK_STATE permissions in AndroidManifest.xml.
06-10 14:45:34.764: ERROR/Ads(6010): ACCESS_NETWORK_STATE permissions must be enabled in AndroidManifest.xml.

/Update

我使用此代码将 AdWhirl 集成到我的应用程序中:

    AdWhirlManager.setConfigExpireTimeout(1000 * 60 * 5);

    AdWhirlTargeting.setAge(28);
    AdWhirlTargeting.setGender(AdWhirlTargeting.Gender.MALE);
    AdWhirlTargeting.setKeywords("banking, credit, interest");
    AdWhirlTargeting.setPostalCode("93047");
    AdWhirlTargeting.setTestMode(true);

    adWhirlLayout = new AdWhirlLayout(this, "my Key");

    RelativeLayout.LayoutParams adWhirlLayoutParams = new RelativeLayout.LayoutParams(
            LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);

    LinearLayout layout = (LinearLayout) findViewById(R.id.layout_adwhirl);

    layout.addView(adWhirlLayout, adWhirlLayoutParams);
    layout.invalidate();

这是布局对于应显示广告的屏幕:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   android:background="#283562">

   <LinearLayout
       android:id="@+id/layout_adwhirl"
       android:orientation="vertical"
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       android:layout_alignParentBottom="true"
       android:layout_centerHorizontal="true"
       android:background="@android:color/black"/>

   <ScrollView
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       android:layout_alignParentTop="true"
       android:layout_above="@id/layout_adwhirl">

      contains the rest of the layout...

  </ScrollView>
</RelativeLayout>

但是 adWhirlLayout 保持为空。如何测试这是因为没有向我投放广告还是因为我在集成 adWhirl 时出现了问题?

I just integrated adwhirl into my android app.
Now I'm a little bit puzzled on how to ensure that ads are shown in my App.

I activated admob as the only ad serving network for now.
After my app starts I get the following log output:

06-10 14:03:08.007: INFO/AdWhirl SDK(4881): Creating adWhirlManager...
06-10 14:03:08.014: DEBUG/AdWhirl SDK(4881): Locale is: de_DE
06-10 14:03:08.014: DEBUG/AdWhirl SDK(4881): Hashed device ID is: ...
06-10 14:03:08.022: INFO/AdWhirl SDK(4881): Finished creating adWhirlManager
06-10 14:03:08.389: DEBUG/AdWhirl SDK(4881): Prefs{...}: {"config": "{"extra":{"location_on":0,"background_color_rgb":{"red":40,"green":53,"blue":98,"alpha":1},"text_color_rgb":{"red":255,"green":255,"blue":255,"alpha":1},"cycle_time":30,"transition":3},"rations":[{"nid":"706a61fa3ec446c7b016bfa9d39256d4","type":1,"nname":"admob","weight":100,"priority":1,"key":"a14deaa0ed3f8f6"}]}
06-10 14:03:08.389: DEBUG/AdWhirl SDK(4881): ", "timestamp": 1307707109720}
06-10 14:03:08.389: INFO/AdWhirl SDK(4881): Using stored config data
06-10 14:03:08.389: DEBUG/AdWhirl SDK(4881): Received jsonString: {"extra":{"location_on":0,"background_color_rgb":{"red":40,"green":53,"blue":98,"alpha":1},"text_color_rgb":{"red":255,"green":255,"blue":255,"alpha":1},"cycle_time":30,"transition":3},"rations":[{"nid":"706a61fa3ec446c7b016bfa9d39256d4","type":1,"nname":"admob","weight":100,"priority":1,"key":"a14deaa0ed3f8f6"}]}
06-10 14:03:08.600: INFO/AdWhirl SDK(4881): Rotating Ad
06-10 14:03:08.600: DEBUG/AdWhirl SDK(4881): Dart is <91.2614682720399> of <100.0>
06-10 14:03:08.921: DEBUG/AdWhirl SDK(4881): Showing ad:
06-10 14:03:08.921: DEBUG/AdWhirl SDK(4881):     nid: 706a61fa3ec446c7b016bfa9d39256d4
06-10 14:03:08.921: DEBUG/AdWhirl SDK(4881):     name: admob
06-10 14:03:08.921: DEBUG/AdWhirl SDK(4881):     type: 1
06-10 14:03:08.921: DEBUG/AdWhirl SDK(4881):     key: a14deaa0ed3f8f6
06-10 14:03:08.921: DEBUG/AdWhirl SDK(4881):     key2: 
06-10 14:03:08.936: DEBUG/AdWhirl SDK(4881): Valid adapter, calling handle()

Update I also found this in the logs

06-10 14:45:34.546: ERROR/Ads(6010): ACCESS_NETWORK_STATE permissions must be enabled in AndroidManifest.xml.
06-10 14:45:34.546: ERROR/Ads(6010): You must have INTERNET and ACCESS_NETWORK_STATE permissions in AndroidManifest.xml.
06-10 14:45:34.764: ERROR/Ads(6010): ACCESS_NETWORK_STATE permissions must be enabled in AndroidManifest.xml.

/Update

I use this code to integrate AdWhirl into my app:

    AdWhirlManager.setConfigExpireTimeout(1000 * 60 * 5);

    AdWhirlTargeting.setAge(28);
    AdWhirlTargeting.setGender(AdWhirlTargeting.Gender.MALE);
    AdWhirlTargeting.setKeywords("banking, credit, interest");
    AdWhirlTargeting.setPostalCode("93047");
    AdWhirlTargeting.setTestMode(true);

    adWhirlLayout = new AdWhirlLayout(this, "my Key");

    RelativeLayout.LayoutParams adWhirlLayoutParams = new RelativeLayout.LayoutParams(
            LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);

    LinearLayout layout = (LinearLayout) findViewById(R.id.layout_adwhirl);

    layout.addView(adWhirlLayout, adWhirlLayoutParams);
    layout.invalidate();

This is the layout for the screen that should show the ads:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   android:background="#283562">

   <LinearLayout
       android:id="@+id/layout_adwhirl"
       android:orientation="vertical"
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       android:layout_alignParentBottom="true"
       android:layout_centerHorizontal="true"
       android:background="@android:color/black"/>

   <ScrollView
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       android:layout_alignParentTop="true"
       android:layout_above="@id/layout_adwhirl">

      contains the rest of the layout...

  </ScrollView>
</RelativeLayout>

The adWhirlLayout however stays empty. How can I test if this is because no ads are served to me or because I did something wrong with integrating adWhirl?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

栀梦 2024-11-21 21:05:26

好的,日志中的这一行显示了问题:

06-10 14:45:34.764: ERROR/Ads(6010): ACCESS_NETWORK_STATE permissions must be enabled in AndroidManifest.xml.

访问网络状态权限对于 admob 来说不是可选的。如果您想使用 Admob,您必须在清单文件中请求此权限。

添加

<uses-permission
    android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>

到应用程序的 manifest.xml 文件中的清单标记。

Ok this line from the log showed the problem:

06-10 14:45:34.764: ERROR/Ads(6010): ACCESS_NETWORK_STATE permissions must be enabled in AndroidManifest.xml.

The access network state permission is not optional for admob. If you want to use Admob you have to ask for this permission in your manifest file.

Add

<uses-permission
    android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>

to the manifest tag in your apps manifest.xml file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文