diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml
index 3cbe93a20c..611fb21b45 100644
--- a/android/AndroidManifest.xml
+++ b/android/AndroidManifest.xml
@@ -7,6 +7,12 @@
android:sharedUserId="com.mapswithme"
android:sharedUserLabel="@string/shared_user_label">
+
+
+
diff --git a/android/build.gradle b/android/build.gradle
index aa6fcb05c0..12e5996233 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -16,6 +16,9 @@ allprojects {
repositories {
jcenter()
mavenCentral()
+ maven {
+ url "https://s3.amazonaws.com/moat-sdk-builds"
+ }
}
}
@@ -54,10 +57,11 @@ dependencies {
compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') { transitive = true }
compile('com.crashlytics.sdk.android:crashlytics-ndk:1.1.2@aar') { transitive = true }
// 3-party
- compile ('com.facebook.android:facebook-android-sdk:4.17.0') {
+ compile ('com.facebook.android:facebook-android-sdk:4.26.0') {
+ exclude group: 'com.google.android.gms'
exclude group: 'com.android.support'
}
- compile('com.facebook.android:audience-network-sdk:4.20.0') {
+ compile('com.facebook.android:audience-network-sdk:4.26.0') {
exclude group: 'com.google.android.gms'
exclude group: 'com.android.support'
}
@@ -67,7 +71,7 @@ dependencies {
compile ('com.my.target:mytarget-sdk:4.6.14') {
exclude group: 'com.android.support'
}
- compile('com.mopub:mopub-sdk-native-static:4.11.0@aar') {
+ compile('com.mopub:mopub-sdk-native-static:4.17.0@aar') {
transitive = true
}
compile fileTree(dir: '3rd_party', include: '*.jar')
diff --git a/android/src/com/mapswithme/maps/ads/FacebookAdsLoader.java b/android/src/com/mapswithme/maps/ads/FacebookAdsLoader.java
index 4fdc048271..f876b313a2 100644
--- a/android/src/com/mapswithme/maps/ads/FacebookAdsLoader.java
+++ b/android/src/com/mapswithme/maps/ads/FacebookAdsLoader.java
@@ -49,6 +49,12 @@ class FacebookAdsLoader extends CachingNativeAdLoader implements AdListener
onAdClicked(ad.getPlacementId());
}
+ @Override
+ public void onLoggingImpression(Ad ad)
+ {
+ LOGGER.i(TAG, "onLoggingImpression");
+ }
+
@Override
void loadAdFromProvider(@NonNull Context context, @NonNull String bannerId)
{
diff --git a/android/src/com/mopub/nativeads/FacebookNative.java b/android/src/com/mopub/nativeads/FacebookNative.java
index 3898abe89b..930e0d2d78 100644
--- a/android/src/com/mopub/nativeads/FacebookNative.java
+++ b/android/src/com/mopub/nativeads/FacebookNative.java
@@ -2,11 +2,11 @@ package com.mopub.nativeads;
import android.content.Context;
import android.view.View;
+import android.view.ViewGroup;
import com.facebook.ads.Ad;
import com.facebook.ads.AdError;
import com.facebook.ads.AdListener;
-import com.facebook.ads.ImpressionListener;
import com.facebook.ads.MediaView;
import com.facebook.ads.NativeAd;
import com.facebook.ads.NativeAd.Rating;
@@ -21,10 +21,12 @@ import java.util.Map;
import static com.mopub.nativeads.NativeImageHelper.preCacheImages;
/**
- * Tested with Facebook SDK 4.15.0. FacebookAdRenderer is also necessary in order to show video ads.
+ * FacebookAdRenderer is also necessary in order to show video ads.
* Video ads will only be shown if VIDEO_ENABLED is set to true or a server configuration
* "video_enabled" flag is set to true. The server configuration will override the local
* configuration.
+ * Please reference the Supported Mediation Partner page at http://bit.ly/2mqsuFH for the
+ * latest version and ad format certifications.
*/
public class FacebookNative extends CustomEventNative {
private static final String PLACEMENT_ID_KEY = "placement_id";
@@ -126,7 +128,24 @@ public class FacebookNative extends CustomEventNative {
return (placementId != null && placementId.length() > 0);
}
- static class FacebookStaticNativeAd extends StaticNativeAd implements AdListener, ImpressionListener {
+ private static void registerChildViewsForInteraction(final View view, final NativeAd nativeAd) {
+ if (nativeAd == null) {
+ return;
+ }
+
+ if (view instanceof ViewGroup && ((ViewGroup) view).getChildCount() > 0) {
+ final ViewGroup vg = (ViewGroup) view;
+ final List clickableViews = new ArrayList<>();
+ for (int i = 0; i < vg.getChildCount(); i++) {
+ clickableViews.add(vg.getChildAt(i));
+ }
+ nativeAd.registerViewForInteraction(view, clickableViews);
+ } else {
+ nativeAd.registerViewForInteraction(view);
+ }
+ }
+
+ static class FacebookStaticNativeAd extends StaticNativeAd implements AdListener {
private static final String SOCIAL_CONTEXT_FOR_AD = "socialContextForAd";
private final Context mContext;
@@ -143,7 +162,6 @@ public class FacebookNative extends CustomEventNative {
void loadAd() {
mNativeAd.setAdListener(this);
- mNativeAd.setImpressionListener(this);
mNativeAd.loadAd();
}
@@ -221,7 +239,6 @@ public class FacebookNative extends CustomEventNative {
notifyAdClicked();
}
- // ImpressionListener
@Override
public void onLoggingImpression(final Ad ad) {
notifyAdImpressed();
@@ -230,7 +247,7 @@ public class FacebookNative extends CustomEventNative {
// BaseForwardingNativeAd
@Override
public void prepare(final View view) {
- mNativeAd.registerViewForInteraction(view);
+ registerChildViewsForInteraction(view, mNativeAd);
}
@Override
@@ -253,7 +270,7 @@ public class FacebookNative extends CustomEventNative {
}
- static class FacebookVideoEnabledNativeAd extends BaseNativeAd implements AdListener, ImpressionListener {
+ static class FacebookVideoEnabledNativeAd extends BaseNativeAd implements AdListener {
private static final String SOCIAL_CONTEXT_FOR_AD = "socialContextForAd";
static final double MIN_STAR_RATING = 0;
@@ -278,7 +295,6 @@ public class FacebookNative extends CustomEventNative {
void loadAd() {
mNativeAd.setAdListener(this);
- mNativeAd.setImpressionListener(this);
mNativeAd.loadAd();
}
@@ -407,7 +423,6 @@ public class FacebookNative extends CustomEventNative {
notifyAdClicked();
}
- // ImpressionListener
@Override
public void onLoggingImpression(final Ad ad) {
notifyAdImpressed();
@@ -416,7 +431,7 @@ public class FacebookNative extends CustomEventNative {
// BaseForwardingNativeAd
@Override
public void prepare(final View view) {
- mNativeAd.registerViewForInteraction(view);
+ registerChildViewsForInteraction(view, mNativeAd);
}
@Override
@@ -450,7 +465,7 @@ public class FacebookNative extends CustomEventNative {
return new HashMap(mExtras);
}
- final public void addExtra( final String key, final Object value) {
+ final public void addExtra(final String key, final Object value) {
if (!Preconditions.NoThrow.checkNotNull(key, "addExtra key is not allowed to be null")) {
return;
}