0

该应用程序看起来很棒,但仍然没有广告。我有 13 个请求和 100% 的填充率,所以我知道它的发送,但我无法显示任何内容。我重新设计了应用程序,并通过几个 div 和按钮使其保持简单。我希望我只是有一些不合适的地方,或者也许你有更好的(仍然简单)的方式来做这件事。我需要让它为另外 3 个应用程序工作。非常感谢您的专业知识,谢谢。

显现:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
 package="com.appsclamation.wowmedesigns"
android:versionCode="1"
android:versionName="1.0" >
<meta-data android:value="true" android:name="ADMOB_ALLOW_LOCATION_FOR_ADS" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="18" />

<application
android:label="@string/app_name" >
<activity
    android:name=".DefaultActivity"
    android:label="@string/app_name" >
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
 </intent-filter>
 </activity>
 <activity 
   android:name="com.google.ads.AdActivity"
  android:configChanges="keyboard|keyboardHidden|orientation|
  screenLayout|uiMode|screenSize|smallestScreenSize" />
  </application>
  </manifest>

主要的:

   <?xml version="1.0" encoding="utf-8"?>
  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
 android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:orientation="vertical" >

   <com.google.ads.AdView android:id="@+id/adView"
    ads:adUnitId="My_ID"
    ads:adSize="BANNER"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    ads:loadAdOnCreate="true"/>
   </LinearLayout>

提前致谢...

DefaultActivity:(源代码?)

 package com.appsclamation.wowmedesigns;

import android.app.Activity;
import android.os.Bundle;
import com.phonegap.*;

public class DefaultActivity extends DroidGap
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        super.setIntegerProperty( "splashscreen", R.drawable.splash );
        super.loadUrl("file:///android_asset/www/index.html", 1000);
    }
}

我的印象是,如果你在 MAIN 中使用 LoadonCreate,你不需要做任何其他事情。

4

1 回答 1

0

您只需要在 mainactivity 中执行此操作:

Adview adView = (AdView) findViewById(R.id.adView);
        adView.loadAd(new AdRequest());

在您的清单中:

<activity
            android:name="com.google.ads.AdActivity"
            android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />

在您的主要活动中使用的布局中:

<com.google.ads.AdView
                android:id="@+id/adView"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                ads:adSize="SMART_BANNER"
                ads:adUnitId="@string/ADMOB_PublisherId"
                ads:loadAdOnCreate="true" />

其中 ADMOB_PublisherId 将是您在注册应用程序后生成的 ID

于 2013-09-14T06:14:21.493 回答