android webview admob not displaying(android webview admob不显示)
问题描述
i want to use google adds at bottom of my page.. into the emulator it properly displays the add but in device it doesn't
it gives me..
07-20 06:16:24.931: WARN/webcore(4289): Can't get the viewWidth after the first layout
07-20 06:16:25.101: WARN/Ads(4289): Invalid unknown request error: Cannot determine request type. Is your ad unit id correct?
07-20 06:16:25.111: INFO/Ads(4289): onFailedToReceiveAd(Invalid Google Ad request.)
07-20 06:16:28.957: WARN/PowerManagerService(175): Timer 0x7->0x3|0x0
07-20 06:16:28.957: INFO/PowerManagerService(175): Ulight 7->3|0
07-20 06:16:30.351: WARN/InputManagerService(175): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@4a43b8f8
07-20 06:16:45.961: WARN/PowerManagerService(175): Timer 0x3->0x1|0x0
07-20 06:16:45.961: INFO/PowerManagerService(175): Ulight 3->1|0
i cant understand what is the problem? the same code is properly running on the emulator but not in device my XML file is
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:id="@+id/rltvLayout"
android:layout_height="fill_parent">
<LinearLayout android:id="@+id/linearLayout1"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:orientation="vertical">
<WebView android:id="@+id/webView" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:fitsSystemWindows="true"/>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:id="@+id/ad_layout"
android:layout_height="wrap_content"
android:gravity="bottom"
android:layout_alignParentBottom="true"
android:layout_alignBottom="@+id/home_layout">
</LinearLayout>
</RelativeLayout>
i've use this in xml file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent" android:id="@+id/rltvLayout1"
android:layout_height="fill_parent">
<LinearLayout android:id="@+id/linearLayoutwebview"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:orientation="vertical">
<WebView android:id="@+id/webView1"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:fitsSystemWindows="true" />
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:id="@+id/ad_layout" android:layout_height="wrap_content"
android:gravity="bottom" android:layout_alignParentBottom="true"
android:layout_alignBottom="@+id/home_layout">
<com.google.ads.AdView android:layout_width="wrap_content"
android:layout_height="wrap_content" ads:adUnitId="here put ID"
ads:adSize="BANNER" android:id="@+id/adView" ads:refreshInterval="60" />
</LinearLayout>
</RelativeLayout>
one more point i found is that
There are some changes to the way Admob works in version 4.1.0
1) Remove attrs.xml (or if you need it for your own custom attributes, remove the parts related to AdViews).
2) Change the namespace in your layout from xmlns:ads="http://schemas.android.com/apk/res/com.your.packagename" to xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" see more...
这篇关于android webview admob不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:android webview admob不显示
基础教程推荐
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01