2011-02-02 73 views
0

我已經爲android編寫了一個應用。我想讓這個廣告免費,所以我決定把admob廣告放在裏面,這樣我仍然可以賺到一些錢。我有兩個問題,在測試模式下,廣告非常褪色,幾乎不可知。儘管這是我兩個問題中較小的一個。我一直聽說如何測試它,但是我怎麼知道當我將應用發佈到Android市場時,實際的應用會出現?我是移動廣告和admob的初學者,所以如果有人能告訴我我應該做什麼,這將是非常感激(包括設置我的應用程序的admob帳戶,我已經有一個帳戶,但有一些我需要的做每個特定的應用程序,我不知道如果我做正確) 這裏是佈局的XML代碼:我如何獲得admob添加到Android應用上的工作

<?xml version="1.0" encoding="utf-8"?> 
<!-- 
!this is the exclusive write of Rothschild Programming LLC 
--> 
<FrameLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_height="fill_parent" 
    android:layout_width="fill_parent"> 

    <LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_height="50dip" 
    android:layout_gravity="top" 
    android:layout_width="fill_parent" 
    android:background="@color/puzzle_foreground"> 

<com.admob.android.ads.AdView 
    xmlns:myapp="http://schemas.android.com/apk/res/com.rothschild.android.gemagria" 
    android:id="@+id/ad3" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    myapp:backgroundColor="@color/puzzle_foreground" 
    myapp:primaryTextColor="@color/puzzle_foreground" 
    myapp:secondaryTextColor="@color/puzzle_foreground" 

    /> 
    </LinearLayout> 

<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:background="@color/dust_tan" 
    android:layout_height="fill_parent" 
    android:layout_width="fill_parent" 
    android:paddingTop="30dip" 
    android:paddingLeft="30dip" 
    android:paddingRight="30dip" 
    android:orientation="horizontal"> 
    <ScrollView 
xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    > 
    <LinearLayout 
     android:orientation="vertical" 
     android:layout_height="wrap_content" 
     android:layout_width="fill_parent" 
     android:layout_gravity="center" 
     xmlns:app="http://schemas.android.com/apk/res/com.rothschild.android.gemagria"> 
     <FrameLayout 
     android:layout_height="wrap_content" 
     android:layout_width="fill_parent" 
     android:layout_gravity="center" 

     > 

     <ImageView 
     android:background="@drawable/icon" 
     android:layout_height="wrap_content" 
     android:layout_width="wrap_content" 
     android:layout_gravity="center"/> 
     </FrameLayout> 
     <TextView 
     android:text="@string/app_name" 
     android:layout_height="wrap_content" 
     android:layout_width="wrap_content" 
     android:layout_gravity="center" 
     android:layout_marginBottom="25dip" 
     android:textColor="@color/puzzle_foreground" 
     android:textSize="24.5sp" /> 

     <Button 
     android:id="@+id/start_button" 
     android:layout_width="fill_parent" 
     android:layout_height="50dip" 
     android:text="Start" /> 
     <Button 
     android:id="@+id/help_button" 
     android:layout_width="fill_parent" 
     android:layout_height="50dip" 
     android:text="Help" /> 
     <Button 
     android:id="@+id/settings_button" 
     android:layout_width="fill_parent" 
     android:layout_height="50dip" 
     android:text="Settings" /> 
     <Button 
     android:id="@+id/exit_button" 
     android:layout_width="fill_parent" 
     android:layout_height="50dip" 
     android:text="Exit" /> 


    </LinearLayout> 
    </ScrollView> 
</LinearLayout> 
</FrameLayout> 

回答

2

轉到您的AdMob帳戶,並建立一個新的網站/應用。這會爲您提供該特定應用的發佈商ID。

這聽起來像你已經做了所有事情,除了添加清單的ID和權限。

像這樣的事情

<!-- The application's publisher ID assigned by AdMob --> 
<meta-data android:value="***************" android:name="ADMOB_PUBLISHER_ID" /> 
<!-- AdMobActivity definition --> 
<activity android:name="com.admob.android.ads.AdMobActivity" 
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 
android:configChanges="orientation|keyboard|keyboardHidden" /> 
<!-- Track Market installs --> 
<receiver android:name="com.admob.android.ads.analytics.InstallReceiver" 
android:exported="true"> 
<intent-filter> 
<action android:name="com.android.vending.INSTALL_REFERRER" /> 
</intent-filter> 
</receiver> 
<meta-data android:value="false" android:name="ADMOB_ALLOW_LOCATION_FOR_ADS"/> 

而添加的權限,以您的清單

<!-- AdMob SDK requires Internet permission --> 
<uses-permission android:name="android.permission.INTERNET" /> 
+0

據瞭解是否有您的應用中展示廣告,看在AdMob帳戶中的填充率。 – Phobos 2011-02-02 15:28:54

相關問題