点击AdMob广告后,我无法通过“后退”按钮返回到我的Android应用 [英] After click AdMob ads, I cannot return to my Android app by back button

查看:93
本文介绍了点击AdMob广告后,我无法通过“后退”按钮返回到我的Android应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下代码在应用程序中添加AdMob。

I add AdMob in my application using the following code.

<?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>

广告显示在我的手机上。但是,当我触摸返回按钮时,它不会返回我的应用程序。而是返回到我先前查看过的手机网页。
欢迎任何建议。

The ad is displayed on my phone. However, it does not return to my app when I touch "Back" button. Instead, it returns to my phone web pages previously viewed. Any suggestions are welcome.

推荐答案

请在您的清单中尝试使用此方法

Please try this in your manifest

<activity android:name="com.google.ads.AdActivity"
     android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:noHistory="true">

特别是 noHistory。它对我有用。

Especially, 'noHistory'. It works for me.

这篇关于点击AdMob广告后,我无法通过“后退”按钮返回到我的Android应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆