自己挣点油钱__AdMob:在android应用中嵌入广告的方案
AdMob:The Mobile Advertising Platform
Industry-leading mobile advertising and monetization solutions from the trusted
name in mobile advertising.
AdMob是一个比较成熟的移动Select "Libraries" tab from the main windowClick on "Add JARs..."Select the JAR copied to the libs directoryClick "OK" to add the SDK to your android project
2、编辑AndroidManifest.xml
Your AdMob publisher ID was given to you when creating your publisher account on www.admob.com before downloading this code. It is a 15-character code like a14a48e3387c5ce. Just before the closing </? ?? ?? ?? ?? ? <uses-permission android:name="android.permission.READ_PHONE_STATE" />
? ?? ?? ?? ?? ? <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
? ?? ???</manifest>? ?? ?
Only the INTERNET permission is required. Setting READ_PHONE_STATE is highly recommended because it identifies the user letting a greater variety of more relevant ads be chosen. Finally setting ACCESS_COARSE_LOCATION (and/or ACCESS_FINE_LOCATION) will let geo-targeted ads be shown.
3、添加attrs.xml
The attrs.xml file specifies custom Ad? ?? ???<resources>
? ?? ?? ?? ?? ? <declare-styleable name="com.admob.android.ads.AdView">
? ?? ?? ?? ?? ?? ?? ?? ?<attr name="testing" format="boolean" />
? ?? ?? ?? ?? ?? ?? ?? ?<attr name="backgroundColor" format="color" />
? ?? ?? ?? ?? ?? ?? ?? ?<attr name="textColor" format="color" />
? ?? ?? ?? ?? ?? ?? ?? ?<attr name="keywords" format="string" />
? ?? ?? ?? ?? ?? ?? ?? ?<attr name="refreshInterval" format="integer" />
? ?? ?? ?? ?? ?? ?? ?? ?<attr name="isGoneWithoutAd" format="boolean" />
? ?? ?? ?? ?? ? </declare-styleable>
? ?? ???</resources>
4、Placing an AdView in a Layout
AdView widgets can be put into any XML layout now. The first step is to reference attrs.xml in your layout element by adding an xmlns line that includes your package name specified in AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
? ? xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:admob<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="18px"
android:paddingBottom="10px"
android:layout_gravity="center"
android:text="eoeAndroid.com立足于Androidadmobsdk:textColor="#FFFFFF"
admobsdk:keywords="Android application"
admobsdk:refreshInterval="60"
/>
</LinearLayout>