开发者

How do I get admob adds to work on an android app

I have written an app for the android. I want to make this ad free, so I have decided to put admob ads in it so that I can still makes some money. I have two problems, in test mode, the ad is very faded and is barely noticable. This is the smaller of my two problems though. I keep hearing about how to test it, but how do I know that when I publish the app to the android market, that actual apps will appear? I am a beginner to mobile ads and admob so if someone could tell me what I should be doing, that would be much appreciate (including setting up the admob account for my app, I already have an account, but there is something I need to do for each specific app, and I'm not sure if I am doing it correctly) here is the xml code for the layout:

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


Go to your admob account and setup a new site/app. This will give you your publisher id for that specific app.

It sounds like you have done everything except add the id and permissions to the manifest.

Something like this

<!-- 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"/>

And add the permission to your manifest

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜