Reputation: 437
I've faced with some kind of an issue.
I tried to integrate the Admob
Native ads (recently added to Google Play Services as I realized) using
manual
https://developers.google.com/admob/android/native
quick start
https://developers.google.com/admob/android/quick-start.
It was OK for a simple banner loaded by AdView
but I really stuck when I changed to loading native ads by AdLoader
.
I'm using Idea + Gradle and Android Annotations.
Here is the Logcat (updated, kindly see to the end of the question):
07-13 17:12:32.260 2548-2580/com.clockbyte.vkgroupwatcher D/dalvikvm﹕ DexOpt: --- BEGIN 'ads-1439082442.jar' (bootstrap=0) ---
07-13 17:12:32.350 2548-2548/com.clockbyte.vkgroupwatcher I/Ads﹕ CsiReporterFactory: CSI is not enabled. No CSI reporter created.
07-13 17:12:32.350 2548-2548/com.clockbyte.vkgroupwatcher I/Ads﹕ Starting ad request.
07-13 17:12:32.840 2548-2580/com.clockbyte.vkgroupwatcher D/dalvikvm﹕ DexOpt: --- END 'ads-1439082442.jar' (success) ---
07-13 17:12:32.840 2548-2580/com.clockbyte.vkgroupwatcher D/dalvikvm﹕ DEX prep '/data/data/com.clockbyte.vkgroupwatcher/cache/ads-1439082442.jar': unzip in 0ms, rewrite 580ms
07-13 17:12:35.100 1798-1826/com.google.android.gms I/Ads﹕ CsiReporterFactory: CSI is not enabled. No CSI reporter created.
07-13 17:12:36.360 2548-2548/com.clockbyte.vkgroupwatcher I/dalvikvm﹕ Could not find method android.webkit.WebSettings.setMixedContentMode, referenced from method com.google.android.gms.ads.internal.t.h.<init>
07-13 17:13:36.351 2548-2612/com.clockbyte.vkgroupwatcher W/Ads﹕ Timed out waiting for native ad.
07-13 17:13:36.351 2548-2613/com.clockbyte.vkgroupwatcher W/Ads﹕ Timeout when loading native ad.
java.util.concurrent.TimeoutException: CallbackFuture timed out.
at com.google.android.gms.ads.internal.util.a.a.get(SourceFile:108)
at com.google.android.gms.ads.internal.o.a.a.b(SourceFile:156)
at com.google.android.gms.ads.internal.o.a.a.call(SourceFile:70)
at com.google.android.gms.ads.internal.util.n.run(SourceFile:75)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
07-13 17:13:36.351 2548-2548/com.clockbyte.vkgroupwatcher W/Ads﹕ Failed to load ad: 2
07-13 17:13:36.351 2548-2548/com.clockbyte.vkgroupwatcher I/com.clockbyte.vkgroupwatcher.ads.AdmobFetcher﹕ Fetching Ad now
07-13 17:13:36.391 1798-1825/com.google.android.gms I/Ads﹕ CsiReporterFactory: CSI is not enabled. No CSI reporter created.
07-13 17:13:36.741 2548-2548/com.clockbyte.vkgroupwatcher I/chromium﹕ [INFO:CONSOLE(0)] "Document was loaded from Application Cache with manifest http://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.appcache", source: http://googleads.g.doubleclick.net/mads/static/mad/sdk/native/native_ads.html (0)
07-13 17:13:36.751 2548-2548/com.clockbyte.vkgroupwatcher I/chromium﹕ [INFO:CONSOLE(0)] "Application Cache Checking event", source: http://googleads.g.doubleclick.net/mads/static/mad/sdk/native/native_ads.html (0)
07-13 17:13:36.861 2548-2548/com.clockbyte.vkgroupwatcher I/chromium﹕ [INFO:CONSOLE(0)] "Application Cache NoUpdate event", source: http://googleads.g.doubleclick.net/mads/static/mad/sdk/native/native_ads.html (0)
07-13 17:13:36.881 2548-2548/com.clockbyte.vkgroupwatcher W/Ads﹕ Failed to load ad: 0
Here is the code for fetching the ad (I call the method prefetchAds
from my extended BaseAdapter
to publish the loaded ad to the ListView
).
package com.clockbyte.vkgroupwatcher.ads;
import android.content.Context;
import android.provider.Settings;
import android.text.TextUtils;
import com.clockbyte.vkgroupwatcher.CbLog;
import com.clockbyte.vkgroupwatcher.Crypt;
import com.clockbyte.vkgroupwatcher.GroupWatcherApplication;
import com.clockbyte.vkgroupwatcher.R;
import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdLoader;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.MobileAds;
import com.google.android.gms.ads.formats.NativeAd;
import com.google.android.gms.ads.formats.NativeAdOptions;
import com.google.android.gms.ads.formats.NativeAppInstallAd;
import com.google.android.gms.ads.formats.NativeContentAd;
public class AdmobFetcher {
private AdLoader adLoader;
private WeakReference<Context> mContext = new WeakReference<>(null);
...
//I call this method once, just to setup AdLoader and fetch the ad.
public synchronized void prefetchAds(Context context) {
mContext = new WeakReference<>(context);
setupAds();
fetchAd();
}
private synchronized void setupAds() {
String admobUnitId = "ca-app-pub-3940256099942544/2247696110"; // the test ad unit id that is pointed in the manual
adLoader = new AdLoader.Builder(mContext.get(), admobUnitId)
.forAppInstallAd(new NativeAppInstallAd.OnAppInstallAdLoadedListener() {
@Override
public void onAppInstallAdLoaded(NativeAppInstallAd appInstallAd) {
onAdFetched(appInstallAd); // Can't get here
}
})
.forContentAd(new NativeContentAd.OnContentAdLoadedListener() {
@Override
public void onContentAdLoaded(NativeContentAd contentAd) {
onAdFetched(contentAd); // Can't get here
}
})
.withAdListener(new AdListener() {
@Override
public void onAdFailedToLoad(int errorCode) {
// Here I got errorCode = 0 each time (kindly check Logcat)
}
})
.withNativeAdOptions(new NativeAdOptions.Builder()
// Methods in the NativeAdOptions.Builder class can be
// used here to specify individual options settings.
//.setReturnUrlsForImageAssets(true)
.build())
.build();
}
/**
* Fetches a new native ad.
*/
private synchronized void fetchAd() {
Context context = mContext.get();
if (context != null) {
adLoader.loadAd(getAdRequest()); //Fetching the ads item
} else {
mFetchFailCount++;
}
}
/**
* Setup and get an AdRequest instance
*/
private synchronized AdRequest getAdRequest() {
String deviceId = "XXXXXXXXXXXXXXX";
return new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR) // All emulators are added by default as test devices
.addTestDevice(deviceId)
.build();
}
...
}
The app's manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.clockbyte.vkgroupwatcher"
android:versionCode="4"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="22" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="com.android.vending.CHECK_LICENSE" />
<application
android:name="GroupWatcherApplication"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<!--This meta-data tag is required to use Google Play Services.-->
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity
android:name=".activities.LoginActivity_"
android:configChanges="keyboardHidden|orientation"
android:launchMode="standard"
android:noHistory="false" >
</activity>
<activity
android:name=".activities.MainContainerActivity_"
android:launchMode="standard" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activities.PreferencesActivity_"
android:theme="@style/SettingsTheme" >
</activity>
<activity
android:name=".activities.WatcherEditActivity_"
android:launchMode="standard" >
</activity>
<activity
android:name=".activities.AddGroupsActivity_"
android:launchMode="standard" >
</activity>
<activity
android:name=".activities.MessageDetailsActivity_"
android:launchMode="standard" >
</activity>
<!--Include the AdActivity configChanges and theme. -->
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
<service
android:name=".service.WatcherService_"
android:enabled="true" />
<receiver
android:name="com.clockbyte.vkgroupwatcher.environment.EnvironmentStateReceiver_"
android:enabled="true" >
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
<action android:name="android.net.wifi.WIFI_STATE_CHANGED" />
<action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
</intent-filter>
</receiver>
</application>
</manifest>
And finally my build.gradle
of the module
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
} }
repositories {
jcenter()
mavenCentral()
mavenLocal() }
apply plugin: 'com.android.application' apply plugin: 'android-apt' def AAVersion = '3.3.1'
apt {
arguments {
androidManifestFile variant.outputs[0].processResources.manifestFile
resourcePackageName 'com.clockbyte.vkgroupwatcher'
} }
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.clockbyte.vkgroupwatcher"
minSdkVersion 11
targetSdkVersion 22
versionCode 6
versionName "1.1"
multiDexEnabled = true
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
dependencies {
apt "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.loopj.android:android-async-http:1.4.7'
compile 'com.google.code.gson:gson:2.3.1'
compile 'org.jsoup:jsoup:1.8.2'
compile 'org.ocpsoft.prettytime:prettytime:4.0.0.Final'
compile 'com.android.support:support-v4:22.2.0'
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.google.android.gms:play-services-ads:7.5.0'
compile 'com.google.android.gms:play-services-appinvite:7.5.0'
compile project(':google-licensing') }
Have I missed something?
Or the Native ads still not supported by Admob
?
Also I tried such things as changing my app unit id from test to real one, testing on the emulator/device and clearing the cache data of Google Play Services on the device - the same result.
Any help/ideas will be highly appreciated...
Updated:
I've removed multidex mode from gradle's config and changed the buildToolsVersion
to the latest one (22.0.1), the logcat is updated to the top of the question. Now the first call of the method fetchAd
fails with code 2 (timeout) and the next calls fail with code 0 as earlier. Kindly take a look at the updated Logcat
Updated2: A log for a real device (android api level 15):
07-14 00:23:26.985 7698-7698/com.clockbyte.vkgroupwatcher I/Ads﹕ CsiReporterFactory: CSI is not enabled. No CSI reporter created.
07-14 00:23:27.015 7698-7698/com.clockbyte.vkgroupwatcher I/Ads﹕ Starting ad request.
07-14 00:23:27.225 7698-7823/com.clockbyte.vkgroupwatcher D/dalvikvm﹕ DexOpt: --- BEGIN 'ads833267715.jar' (bootstrap=0) ---
07-14 00:23:27.365 7698-7823/com.clockbyte.vkgroupwatcher D/dalvikvm﹕ DexOpt: --- END 'ads833267715.jar' (success) ---
07-14 00:23:27.365 7698-7823/com.clockbyte.vkgroupwatcher D/dalvikvm﹕ DEX prep '/data/data/com.clockbyte.vkgroupwatcher/cache/ads833267715.jar': unzip in 0ms, rewrite 139ms
07-14 00:23:36.424 7433-7443/? I/Ads﹕ CsiReporterFactory: CSI is not enabled. No CSI reporter created.
07-14 00:23:36.454 7433-7863/? I/Ads﹕ CsiReporterFactory: CSI is not enabled. No CSI reporter created.
07-14 00:23:36.504 7433-7863/? I/dalvikvm﹕ Could not find method android.net.ConnectivityManager.isActiveNetworkMetered, referenced from method com.google.android.gms.ads.internal.request.a.r.a
07-14 00:23:36.584 7433-7433/? I/dalvikvm﹕ Could not find method android.webkit.WebSettings.setMixedContentMode, referenced from method com.google.android.gms.ads.internal.t.h.<init>
07-14 00:23:36.584 7433-7433/? I/dalvikvm﹕ Could not find method android.webkit.WebView.evaluateJavascript, referenced from method com.google.android.gms.ads.internal.t.h.evaluateJavascript
07-14 00:23:36.594 7433-7433/? I/dalvikvm﹕ Could not find method com.google.android.gms.ads.internal.t.h.isAttachedToWindow, referenced from method com.google.android.gms.ads.internal.t.h.onDraw
07-14 00:23:36.594 7433-7433/? W/dalvikvm﹕ VFY: unable to resolve virtual method 6452: Lcom/google/android/gms/ads/internal/t/h;.isAttachedToWindow ()Z
07-14 00:23:36.624 7433-7857/? D/skia﹕ WebFrame::loadStarted (1) https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.html
07-14 00:23:37.295 7433-7857/? D/skia﹕ WebFrame::loadStarted (0) gmsg://mobileads.google.com/loadAdURL?drt_include=1&request_id=d72e3527-8d9a-4f0c-b771-18f9f922403c&request_scenario=online_request&type=admob&url=https%3A%2F%2Fgoogleads.g.doubleclick.net%2Fmads%2Fgma%3Fsession_id%3D157010986198
07-14 00:23:37.295 7433-7433/? W/Ads﹕ JS: The page at about:blank displayed insecure content from gmsg://mobileads.google.com/loadAdURL?drt_include=1&request_id=d72e3527-8d9a-4f0c-b771-18f9f922403c&request_scenario=online_request&type=admob&url=https%3A%2F%2Fgoogleads.g.doubleclick.net%2Fmads%2Fgma%3Fsession_id%3D15701098619806543204%26seq_num%3D1%26rm%3D1%26fdz%3D-1%26adtest%3Don%26js%3Dafma-sdk-a-v7574000.7571000.1%26eid%3D46621077%252C46621098%252C318474371%26hl%3Dru%26submodel%3DHTC%2520Sensation%2520XE%2520with%2520Beats%2520Audio%2520Z715e%26gnt%3D0%26native_templates%3D1%252C2%26ma%3D0%26platform%3DHTC%26forceHttps%3Dtrue%26u_sd%3D1.5%26sp%3D0%26cnt%3D1%26native_version%3D3%26muv%3D15%26riv%3D0%26ms%3DbBaKMM241P7ZUZbIw630exH1iY80ufKc8Z12nKVbEOI4eDpWg2KlW24F0xUKsi7r1FLSD9ISfYeAdN8C_jtjpY6xx5wG5BARDyrZUgeW_qnHTavdTzBzrpSaI1-3y19EgkD3mrsTe5XMetskcd4lTidQnf63xhT8BeE9u1LAJb1pTp_N8TssVCQNtBBRk59fPAK8olxqwKJm-nDWnLngOBSH0F_dXlmb_-ZhxT0VwHw8Hv406I5dXx2jh6YAvc0kd_cJwwBfLhCXEnxqcNCgAhLJWbdnzqf2kYziboXI8BGqqPbVNRNeKqzWB149Ri-q0no25qbKdZIbT0yuMNMkgA%26mv%3D80321300.com.android.vending%26format%3D320x50_mb%26coh%3D1%26gl%3DRU%26request_id%3Dd72e3527-8d9a-4f0c-b771-18f9f922403c%26am%3D0%26native_image_orientation%3Dany%26u_w%3D360%26u_h%3D640%26msid%3Dcom.clockbyte.vkgroupwatcher%26app_name%3D6.android.com.clockbyte.vkgroupwatcher%26an%3D6.android.com.clockbyte.vkgroupwatcher%26net%3Dwi%26u_audio%3D3%26u_so%3Dp%26preqs%3D0%26support_transparent_background%3Dtrue%26pimp%3D0%26currts%3D4989768%26pclick%3D0%26basets%3D4989768%26output%3Dhtml%26region%3Dmobile_app%26u_tz%3D180%26client_sdk%3D1%26ex%3D1%26client%3Dca-app-pub-3940256099942544%26slotname%3D6300978111%26gsb%3Dwi%26bisch%3Dtrue%26blev%3D0.55%26cans%3D-1%26canm%3Dfalse%26caps%3DinlineVideo_interactiveVideo_mraid1_mraid2_th_autoplay_mediation_transparentBackground_sdkAdmobApiForAds_di%26_efs%3Dfalse%26blockAutoClicks%3D0%26forceGmsDoritos%3D1%26tcar%3D46%26jsv%3D176%26urll%3D1435&base_uri=https%3A%2F%2Fgoogleads.g.doubleclick.net%2Fmads%2Fgma&use_webview_loadurl=0&enable_auto_click_protection=0&google.afma.Notify_dt=1436822617303.
(null:1)
07-14 00:23:37.295 7433-7433/? W/Web Console﹕ The page at about:blank displayed insecure content from gmsg://mobileads.google.com/loadAdURL?drt_include=1&request_id=d72e3527-8d9a-4f0c-b771-18f9f922403c&request_scenario=online_request&type=admob&url=https%3A%2F%2Fgoogleads.g.doubleclick.net%2Fmads%2Fgma%3Fsession_id%3D15701098619806543204%26seq_num%3D1%26rm%3D1%26fdz%3D-1%26adtest%3Don%26js%3Dafma-sdk-a-v7574000.7571000.1%26eid%3D46621077%252C46621098%252C318474371%26hl%3Dru%26submodel%3DHTC%2520Sensation%2520XE%2520with%2520Beats%2520Audio%2520Z715e%26gnt%3D0%26native_templates%3D1%252C2%26ma%3D0%26platform%3DHTC%26forceHttps%3Dtrue%26u_sd%3D1.5%26sp%3D0%26cnt%3D1%26native_version%3D3%26muv%3D15%26riv%3D0%26ms%3DbBaKMM241P7ZUZbIw630exH1iY80ufKc8Z12nKVbEOI4eDpWg2KlW24F0xUKsi7r1FLSD9ISfYeAdN8C_jtjpY6xx5wG5BARDyrZUgeW_qnHTavdTzBzrpSaI1-3y19EgkD3mrsTe5XMetskcd4lTidQnf63xhT8BeE9u1LAJb1pTp_N8TssVCQNtBBRk59fPAK8olxqwKJm-nDWnLngOBSH0F_dXlmb_-ZhxT0VwHw8Hv406I5dXx2jh6YAvc0kd_cJwwBfLhCXEnxqcNCgAhLJWbdnzqf2kYziboXI8BGqqPbVNRNeKqzWB149Ri-q0no25qbKdZIbT0yuMNMkgA%26mv%3D80321300.com.android.vending%26format%3D320x50_mb%26coh%3D1%26gl%3DRU%26request_id%3Dd72e3527-8d9a-4f0c-b771-18f9f922403c%26am%3D0%26native_image_orientation%3Dany%26u_w%3D360%26u_h%3D640%26msid%3Dcom.clockbyte.vkgroupwatcher%26app_name%3D6.android.com.clockbyte.vkgroupwatcher%26an%3D6.android.com.clockbyte.vkgroupwatcher%26net%3Dwi%26u_audio%3D3%26u_so%3Dp%26preqs%3D0%26support_transparent_background%3Dtrue%26pimp%3D0%26currts%3D4989768%26pclick%3D0%26basets%3D4989768%26output%3Dhtml%26region%3Dmobile_app%26u_tz%3D180%26client_sdk%3D1%26ex%3D1%26client%3Dca-app-pub-3940256099942544%26slotname%3D6300978111%26gsb%3Dwi%26bisch%3Dtrue%26blev%3D0.55%26cans%3D-1%26canm%3Dfalse%26caps%3DinlineVideo_interactiveVideo_mraid1_mraid2_th_autoplay_mediation_transparentBackground_sdkAdmobApiForAds_di%26_efs%3Dfalse%26blockAutoClicks%3D0%26forceGmsDoritos%3D1%26tcar%3D46%26jsv%3D176%26urll%3D1435&base_uri=https%3A%2F%2Fgoogleads.g.doubleclick.net%2Fmads%2Fgma&use_webview_loadurl=0&enable_auto_click_protection=0&google.afma.Notify_dt=1436822617303.
at null:1
07-14 00:23:37.335 7433-7857/? D/skia﹕ WebFrame::loadStarted (0) gmsg://mobileads.google.com/loadAdURL?drt_include=1&request_id=d72e3527-8d9a-4f0c-b771-18f9f922403c&request_scenario=online_request&type=admob&url=https%3A%2F%2Fgoogleads.g.doubleclick.net%2Fmads%2Fgma%3Fsession_id%3D157010986198
07-14 00:23:37.345 7433-7433/? W/Ads﹕ JS: The page at about:blank displayed insecure content from gmsg://mobileads.google.com/loadAdURL?drt_include=1&request_id=d72e3527-8d9a-4f0c-b771-18f9f922403c&request_scenario=online_request&type=admob&url=https%3A%2F%2Fgoogleads.g.doubleclick.net%2Fmads%2Fgma%3Fsession_id%3D15701098619806543204%26seq_num%3D1%26rm%3D1%26fdz%3D-1%26adtest%3Don%26js%3Dafma-sdk-a-v7574000.7571000.1%26eid%3D46621077%252C46621098%252C318474371%26hl%3Dru%26submodel%3DHTC%2520Sensation%2520XE%2520with%2520Beats%2520Audio%2520Z715e%26gnt%3D0%26native_templates%3D1%252C2%26ma%3D0%26platform%3DHTC%26forceHttps%3Dtrue%26u_sd%3D1.5%26sp%3D0%26cnt%3D1%26native_version%3D3%26muv%3D15%26riv%3D0%26ms%3DbBaKMM241P7ZUZbIw630exH1iY80ufKc8Z12nKVbEOI4eDpWg2KlW24F0xUKsi7r1FLSD9ISfYeAdN8C_jtjpY6xx5wG5BARDyrZUgeW_qnHTavdTzBzrpSaI1-3y19EgkD3mrsTe5XMetskcd4lTidQnf63xhT8BeE9u1LAJb1pTp_N8TssVCQNtBBRk59fPAK8olxqwKJm-nDWnLngOBSH0F_dXlmb_-ZhxT0VwHw8Hv406I5dXx2jh6YAvc0kd_cJwwBfLhCXEnxqcNCgAhLJWbdnzqf2kYziboXI8BGqqPbVNRNeKqzWB149Ri-q0no25qbKdZIbT0yuMNMkgA%26mv%3D80321300.com.android.vending%26format%3D320x50_mb%26coh%3D1%26gl%3DRU%26request_id%3Dd72e3527-8d9a-4f0c-b771-18f9f922403c%26am%3D0%26native_image_orientation%3Dany%26u_w%3D360%26u_h%3D640%26msid%3Dcom.clockbyte.vkgroupwatcher%26app_name%3D6.android.com.clockbyte.vkgroupwatcher%26an%3D6.android.com.clockbyte.vkgroupwatcher%26net%3Dwi%26u_audio%3D3%26u_so%3Dp%26preqs%3D0%26support_transparent_background%3Dtrue%26pimp%3D0%26currts%3D4989768%26pclick%3D0%26basets%3D4989768%26output%3Dhtml%26region%3Dmobile_app%26u_tz%3D180%26client_sdk%3D1%26ex%3D1%26client%3Dca-app-pub-3940256099942544%26slotname%3D6300978111%26gsb%3Dwi%26bisch%3Dtrue%26blev%3D0.55%26cans%3D-1%26canm%3Dfalse%26caps%3DinlineVideo_interactiveVideo_mraid1_mraid2_th_autoplay_mediation_transparentBackground_sdkAdmobApiForAds_di%26_efs%3Dfalse%26blockAutoClicks%3D0%26forceGmsDoritos%3D1%26tcar%3D46%26jsv%3D176%26urll%3D1435&base_uri=https%3A%2F%2Fgoogleads.g.doubleclick.net%2Fmads%2Fgma&use_webview_loadurl=0&enable_auto_click_protection=0&google.afma.Notify_dt=1436822617303.
(null:1)
07-14 00:23:37.345 7433-7433/? W/Web Console﹕ The page at about:blank displayed insecure content from gmsg://mobileads.google.com/loadAdURL?drt_include=1&request_id=d72e3527-8d9a-4f0c-b771-18f9f922403c&request_scenario=online_request&type=admob&url=https%3A%2F%2Fgoogleads.g.doubleclick.net%2Fmads%2Fgma%3Fsession_id%3D15701098619806543204%26seq_num%3D1%26rm%3D1%26fdz%3D-1%26adtest%3Don%26js%3Dafma-sdk-a-v7574000.7571000.1%26eid%3D46621077%252C46621098%252C318474371%26hl%3Dru%26submodel%3DHTC%2520Sensation%2520XE%2520with%2520Beats%2520Audio%2520Z715e%26gnt%3D0%26native_templates%3D1%252C2%26ma%3D0%26platform%3DHTC%26forceHttps%3Dtrue%26u_sd%3D1.5%26sp%3D0%26cnt%3D1%26native_version%3D3%26muv%3D15%26riv%3D0%26ms%3DbBaKMM241P7ZUZbIw630exH1iY80ufKc8Z12nKVbEOI4eDpWg2KlW24F0xUKsi7r1FLSD9ISfYeAdN8C_jtjpY6xx5wG5BARDyrZUgeW_qnHTavdTzBzrpSaI1-3y19EgkD3mrsTe5XMetskcd4lTidQnf63xhT8BeE9u1LAJb1pTp_N8TssVCQNtBBRk59fPAK8olxqwKJm-nDWnLngOBSH0F_dXlmb_-ZhxT0VwHw8Hv406I5dXx2jh6YAvc0kd_cJwwBfLhCXEnxqcNCgAhLJWbdnzqf2kYziboXI8BGqqPbVNRNeKqzWB149Ri-q0no25qbKdZIbT0yuMNMkgA%26mv%3D80321300.com.android.vending%26format%3D320x50_mb%26coh%3D1%26gl%3DRU%26request_id%3Dd72e3527-8d9a-4f0c-b771-18f9f922403c%26am%3D0%26native_image_orientation%3Dany%26u_w%3D360%26u_h%3D640%26msid%3Dcom.clockbyte.vkgroupwatcher%26app_name%3D6.android.com.clockbyte.vkgroupwatcher%26an%3D6.android.com.clockbyte.vkgroupwatcher%26net%3Dwi%26u_audio%3D3%26u_so%3Dp%26preqs%3D0%26support_transparent_background%3Dtrue%26pimp%3D0%26currts%3D4989768%26pclick%3D0%26basets%3D4989768%26output%3Dhtml%26region%3Dmobile_app%26u_tz%3D180%26client_sdk%3D1%26ex%3D1%26client%3Dca-app-pub-3940256099942544%26slotname%3D6300978111%26gsb%3Dwi%26bisch%3Dtrue%26blev%3D0.55%26cans%3D-1%26canm%3Dfalse%26caps%3DinlineVideo_interactiveVideo_mraid1_mraid2_th_autoplay_mediation_transparentBackground_sdkAdmobApiForAds_di%26_efs%3Dfalse%26blockAutoClicks%3D0%26forceGmsDoritos%3D1%26tcar%3D46%26jsv%3D176%26urll%3D1435&base_uri=https%3A%2F%2Fgoogleads.g.doubleclick.net%2Fmads%2Fgma&use_webview_loadurl=0&enable_auto_click_protection=0&google.afma.Notify_dt=1436822617303.
at null:1
07-14 00:23:37.365 7433-7433/? W/Ads﹕ JS: The page at https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.html displayed insecure content from file:///android_asset/webkit/android-weberror.png.
(null:1)
07-14 00:23:37.365 7433-7433/? W/Web Console﹕ The page at https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.html displayed insecure content from file:///android_asset/webkit/android-weberror.png.
at null:1
07-14 00:23:38.155 7433-7857/? D/skia﹕ WebFrame::loadStarted (1) about:blank
07-14 00:23:38.276 7698-7698/com.clockbyte.vkgroupwatcher I/dalvikvm﹕ Could not find method android.webkit.WebSettings.setMixedContentMode, referenced from method com.google.android.gms.ads.internal.t.h.<init>
07-14 00:23:38.286 7698-7698/com.clockbyte.vkgroupwatcher I/dalvikvm﹕ Could not find method android.webkit.WebView.evaluateJavascript, referenced from method com.google.android.gms.ads.internal.t.h.evaluateJavascript
07-14 00:23:38.286 7698-7698/com.clockbyte.vkgroupwatcher I/dalvikvm﹕ Could not find method com.google.android.gms.ads.internal.t.h.isAttachedToWindow, referenced from method com.google.android.gms.ads.internal.t.h.onDraw
07-14 00:23:38.286 7698-7698/com.clockbyte.vkgroupwatcher W/dalvikvm﹕ VFY: unable to resolve virtual method 6452: Lcom/google/android/gms/ads/internal/t/h;.isAttachedToWindow ()Z
07-14 00:23:38.336 7698-7827/com.clockbyte.vkgroupwatcher D/skia﹕ WebFrame::loadStarted (1) https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/native_ads.html
07-14 00:23:38.916 7698-7827/com.clockbyte.vkgroupwatcher D/skia﹕ WebFrame::loadStarted (0) gmsg://mobileads.google.com/nativeAdPreProcess?failure=true&google.afma.Notify_dt=1436822618925
07-14 00:23:38.926 7698-7698/com.clockbyte.vkgroupwatcher W/Ads﹕ JS: The page at about:blank displayed insecure content from gmsg://mobileads.google.com/nativeAdPreProcess?failure=true&google.afma.Notify_dt=1436822618925.
(null:1)
07-14 00:23:38.926 7698-7698/com.clockbyte.vkgroupwatcher W/Web Console﹕ The page at about:blank displayed insecure content from gmsg://mobileads.google.com/nativeAdPreProcess?failure=true&google.afma.Notify_dt=1436822618925.
at null:1
07-14 00:23:38.946 7698-7698/com.clockbyte.vkgroupwatcher W/Ads﹕ Failed to load ad: 0
Updated 3 I tried to get the Content ads only (by commenting the corresponding block in the AdLoader.Builder) as @RedBrogdon adviced. Here is the log
08-17 12:07:16.806 4918-5025/com.engineers.admobtest54321 D/dalvikvm﹕ DexOpt: --- BEGIN 'ads-973066727.jar' (bootstrap=0) ---
08-17 12:07:16.926 4918-5025/com.engineers.admobtest54321 D/dalvikvm﹕ DexOpt: --- END 'ads-973066727.jar' (success) ---
08-17 12:07:16.926 4918-5025/com.engineers.admobtest54321 D/dalvikvm﹕ DEX prep '/data/data/com.engineers.admobtest54321/cache/ads-973066727.jar': unzip in 0ms, rewrite 123ms
08-17 12:07:16.946 4918-4918/com.engineers.admobtest54321 I/Ads﹕ Starting ad request.
08-17 12:07:17.566 4918-5055/com.engineers.admobtest54321 I/Ads﹕ Trying mediation network:
08-17 12:07:17.576 4918-4918/com.engineers.admobtest54321 I/Ads﹕ Instantiating mediation adapter: com.google.DummyAdapter
08-17 12:07:17.576 4918-4918/com.engineers.admobtest54321 W/Ads﹕ Could not instantiate mediation adapter: com.google.DummyAdapter. com.google.DummyAdapter
08-17 12:07:17.576 4918-5055/com.engineers.admobtest54321 I/Ads﹕ No fill from any mediation ad networks.
08-17 12:07:17.576 4918-4918/com.engineers.admobtest54321 W/Ads﹕ Failed to load ad: 3
Upvotes: 6
Views: 19939
Reputation: 6058
Might not help everyone, but DON'T FORGET TO TURN OFF ALL KINDS OF ADBLOCKERS.
I had a adblocker DNS configured, took me a couple of hours to finally find that out :D
Upvotes: 0
Reputation: 1038
I think it was a size problem.
Please try with Native Express id:
ca-app-pub-3940256099942544/2793859312(Small template)
Or refer to: https://developers.google.com/admob/android/test-ads
Upvotes: 0
Reputation: 31
As Native Advanced is still in beta, you would have to request to signup with the https://support.google.com/admob/contact/account_setup?rd=1
Upvotes: 0
Reputation: 437
BTW I decided to post my solution for publishing Native Ads into ListView items to admobadapter. Hope it will help someone. The result will look like this
The basic usage could look like:
ListView lvMessages;
AdmobAdapterWrapper adapterWrapper;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initListViewItems();
}
/**
* Inits an adapter with items, wrapping your adapter with a {@link AdmobAdapterWrapper} and setting the listview to this wrapper
* FIRST OF ALL Please notice that the following code will work on a real devices but emulator!
*/
private void initListViewItems() {
lvMessages = (ListView) findViewById(R.id.lvMessages);
//creating your adapter, it could be a custom adapter as well
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1);
adapterWrapper = new AdmobAdapterWrapper(this);
adapterWrapper.setAdapter(adapter); //wrapping your adapter with a AdmobAdapterWrapper.
//here you can use the following string to set your custom layouts for a different types of native ads
//adapterWrapper.setInstallAdsLayoutId(R.layout.your_installad_layout);
//adapterWrapper.setcontentAdsLayoutId(R.layout.your_installad_layout);
//Sets the max count of ad blocks per dataset, by default it equals to 3 (according to the Admob's policies and rules)
adapterWrapper.setLimitOfAds(3);
//Sets the number of your data items between ad blocks, by default it equals to 10.
//You should set it according to the Admob's policies and rules which says not to
//display more than one ad block at the visible part of the screen,
// so you should choose this parameter carefully and according to your item's height and screen resolution of a target devices
adapterWrapper.setNoOfDataBetweenAds(10);
//It's a test admob ID. Please replace it with a real one only when you will be ready to deploy your product to the Release!
//Otherwise your Admob account could be banned
//String admobUnitId = getResources().getString(R.string.banner_admob_unit_id);
//adapterWrapper.setAdmobReleaseUnitId(admobUnitId);
lvMessages.setAdapter(adapterWrapper); // setting an AdmobAdapterWrapper to a ListView
//preparing the collection of data
final String sItem = "item #";
ArrayList<String> lst = new ArrayList<String>(100);
for(int i=1;i<=100;i++)
lst.add(sItem.concat(Integer.toString(i)));
//adding a collection of data to your adapter and rising the data set changed event
adapter.addAll(lst);
adapter.notifyDataSetChanged();
}
Upvotes: 0
Reputation: 8935
Note from documentation
Note: At the current time, publishers should not use the addTestDevice method with native ad requests. Using the above ad unit ID with calls to addTestDevice is the current best practice for testing.
So try removing calls to addTestDevice(deviceId)
. I've had same issue and its start working after I've done that.
Upvotes: 10