我的布局整合了Google Play服务广告时出现问题。我做了我在网上看到的所有内容,没有任何对我有用。
注意:“XXX”或“X”仅用于隐藏某些信息。
这是我的布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height=
"wrap_content" android:gravity="center">
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ff000000"
android:gravity="center_horizontal" >
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-XXXXXXX" />
</RelativeLayout>
<ListView android:id="@+id/timetable" android:choiceMode="none"
android:layout_width="230px" android:layout_height="205px"
android:padding="5dip" />
<TextView style="@style/finePrint" android:id="@+id/notes"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
</LinearLayout>
我在清单中做了什么:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="XXX"
android:versionCode="X"
android:versionName="x" >
<uses-sdk
android:minSdkVersion="3"
android:targetSdkVersion="4" />
<supports-screens />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- Include required permissions for Google Mobile Ads to run -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_GPS" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application
android:description="@string/description"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/DialogTheme" >
<!--This meta-data tag is required to use Google Play Services.-->
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity
android:name=".XXX"
android:configChanges="keyboardHidden|orientation|locale"
android:label="@string/app_name"
android:launchMode="singleTop" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name=".receiver.StartNotificationReceiver" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<receiver android:name=".receiver.ClickNotificationReceiver" />
<receiver android:name=".receiver.ClearNotificationReceiver" />
<service android:name=".service.FillDailyTimetableService" />
<service android:name=".service.StartNotificationService" />
<receiver
android:name=".widget.TimetableWidgetProvider"
android:label="@string/adhan_timetable" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget_timetable" />
</receiver>
<receiver
android:name=".widget.NextNotificationWidgetProvider"
android:label="@string/XXX" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget_next_notification" />
<!-- Include the AdActivity configChanges and theme. -->
</receiver>
<!--Include the AdActivity configChanges and theme. -->
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
</application>
</manifest>
但是当我尝试午餐时,它不会“不幸的是,XXX已经停止了”
我做错了什么?
答案 0 :(得分:0)
要使用AdMob,您需要注册一个帐户。 AdMob帐户由一个AdSense帐户和一个AdWords帐户组成。在注册过程中,Google会审核您当前的AdSense和AdWords帐户,或者帮助您创建新帐户。然后,谷歌连接它们以创建您的新AdMob帐户。 create your own admob account或read this
AdMob for Android本指南将向您展示如何将Google移动广告SDK集成到一个全新的应用中,并使用它来显示简单的横幅广告