2011-02-02 71 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

相关问题