我使用以下代码在我的应用程序中添加AdMob。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:layout_height="fill_parent"
android:orientation="vertical" >
<com.google.ads.AdView
android:id="@+id/adview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="SMART_BANNER"
ads:adUnitId="ca-app-pub-*************************"
ads:loadAdOnCreate="true"
ads:testDevices="********************"
/>
<TabHost
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<TabWidget
android:id="@android:id/tabs"
android:textSize="12sp"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</FrameLayout>
</LinearLayout>
</TabHost>
</LinearLayout>
广告显示在我的手机上。然而,当我点击“后退”按钮时,它不会返回到我的应用程序。相反,它返回到我以前看过的手机网页。欢迎任何建议。
发布于 2013-12-31 18:03:11
请在你的舱单上试试这个。
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:noHistory="true">
尤其是“没有历史”。对我来说很管用。
发布于 2013-12-18 16:50:31
对我来说,这是预料中的行为,因为我偶尔也会发生这种事。一旦用户点击广告,后退按钮就会绑定到随后打开的应用程序上。它通常是谷歌游戏或你手机的浏览器。
在Google Play中,单击back通常会让您直接回到应用程序。然而,在您的浏览器中,按回将使您回到以前查看过的页面(就像在浏览器中按回),或者如果没有,则返回到您的应用程序。
一旦用户点击广告,控制后退按钮是你的手,真的。
发布于 2013-12-18 16:57:59
当点击admob广告时,整个互联网浏览器应用程序就会启动,而不仅仅是一个显示网页的活动。正如badgerati所说,这就是你的应用程序在互联网下面浏览的原因。为了突出这一问题,当你启动图片库应用程序来查看图片(从你的应用程序)时,只有Vies image活动启动,而不是整个大型应用程序,因此当您单击“后退”时,您返回到您的应用程序。但不幸的是,浏览器的情况并不相同。
https://stackoverflow.com/questions/20663480
复制相似问题