我不知道为什么,但Admob不会展示我的广告,但我的应用程序运行完美。
这是我的活动:
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.d("GameActivity", "started");
context = this.getApplicationContext();
Uri game = this.getIntent().getData();
if (game != null) {
if (game.getScheme().equals ("file")) {
gamePath = game.getPath();
} else {
copyGameToCache (game);
}
Log.d("GameActivity", "Selected the file: " + getGamePath());
}
super.onCreate(savedInstanceState);
getWindowManager().getDefaultDisplay().getMetrics(metrics);
adView = new AdView(mSingleton);
adView.setAdSize(AdSize.BANNER);
adView.setAdUnitId("ca-app-pub-1209995634500922/8885931497");
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
params.addRule(RelativeLayout.CENTER_HORIZONTAL);
AdRequest adRequest = new AdRequest.Builder().build();
adView.loadAd(adRequest);
mLayout.addView(adView, params);
}
这是我的androidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest package="org.love2d.android"
android:versionCode="14"
android:versionName="0.9.1b"
android:installLocation="auto" xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<!-- Allow writing to external storage -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="Application"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<service android:name=".DownloadService" />
<activity
android:name="GameActivity"
android:configChanges="orientation|screenSize"
android:label="Application"
android:screenOrientation="landscape" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="tv.ouya.intent.category.GAME"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="file" />
<data android:scheme="content" />
<data android:mimeType="application/x-love-game" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="file" />
<data android:mimeType="*/*" />
<data android:pathPattern=".*\\.love" />
<data android:host="*" />
</intent-filter>
</activity>
<activity
android:name="DownloadActivity"
android:noHistory="true" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http"
android:host="*"
android:pathPrefix="*"
android:mimeType="*/*"
android:pathPattern=".*\\.love" />
<data android:scheme="https"
android:host="*"
android:pathPrefix="*"
android:mimeType="*/*"
android:pathPattern=".*\\.love" />
</intent-filter>
</activity>
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent"/>
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>
<!-- Android 2.3.3 -->
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" />
<!-- OpenGL ES 2.0 -->
<uses-feature android:glEsVersion="0x00020000" />
</manifest>
我的应用程序启动没有任何错误,我可以完美地使用它,但它不显示广告。 有人能告诉我我做错了什么吗?
答案 0 :(得分:0)
你可能需要放一个测试设备,如下所示:
String android_id = Settings.Secure.getString(this.getContentResolver(), Settings.Secure.ANDROID_ID);
MessageDigest md5 = MessageDigest.getInstance("MD5");
byte[] digest = md5.digest(android_id.getBytes());
String deviceId = Base64.encodeToString(digest, 0);
AdRequest adRequest = new dRequest.Builder().addTestDevice("17BB429573B0FA8677D27957B98C7005").build();
adView.loadAd(adRequest);