-
Notifications
You must be signed in to change notification settings - Fork 4
Pegasi SDK Mediation Other Advertising Sources SDK
This document details the process of Pegasi mediation others(facebook,admob,yahoo,mopub) ads.
Notice:if you access others ads you must access pegasi ad;
Here are the basic integration steps:
1.Obtain the adapter and other ads jar or aar from github(Download PEGASI SDK)
2.Add this adapter AndroidManifest, Confusion script and jar or aar to your project.
3.add access code in you project.
##2.Add adapter and jar or aar to you project.
if you access facebook you should add this line in build gradle:
compile files('libs/xxxx.jar') or compile fileTree(dir:'libs', include:['*.jar'])
**Notice:if facebook sdk version is 4.10.1 or more than 4.10.1,you must add compile 'com.android.support:recyclerview-v7:21.0.3'**;
if you access yahoo you should add this line in build gradle:
compile files('libs/xxxx.jar') or compile fileTree(dir:'libs', include:['*.jar'])
if you access mopub you should add this line in build gradle:
compile files('libs/xxxx.jar') or compile fileTree(dir:'libs', include:['*.jar'])
if you access admob you should add this line in build gradle:
repositories {
flatDir {
dirs 'libs'
}
}
compile(name: 'xxxx', ext: 'aar')
**Notice:if admob sdk version is 9.0.0 or more than 9.0.0 ,you can only add compile 'com.google.firebase:firebase-ads:xxxx' and not add aar into libs file**;
####2.2、Add adapter to you project;
Create a new Package the Package name is “com.cmcm.adsdk.adapter”,and then put the xxxAdapter.java into this package. the adapter you can get in pegasi mediation others ads file.
####2.3、Updating your Android Manifest
<!--for Mopub -->
<activity android:name="com.mopub.mobileads.MoPubActivity"
android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.mopub.mobileads.MraidActivity"
android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.mopub.common.MoPubBrowser"
android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity android:name="com.mopub.mobileads.MraidVideoPlayerActivity"
android:configChanges="keyboardHidden|orientation|screenSize"/>
<!--for Mopub-->Add this tag to your to use Google Play Services:
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />####2.4、add Confusion script
if you integrated FaceBook,add NativeAd Proguard script
-dontwarn com.facebook.ads.**
-keep class com.facebook.ads.**{*;}if you integrated Mopub,add NativeAd Proguard script
-keep class com.mopub.nativeads.*{*;}
-keep class com.mopub.common.**{*;}
-keep class com.mopub.network.**{*;}
-dontwarn com.mopub.**
-keep class com.cmcm.adsdk.nativead.MopubNativeAdLoader{
<fields>;
<methods>;
}
-keep class com.mopub.mobileads.MoPubActivity{
<fields>;
<methods>;
}
-keep class com.mopub.mobileads.MraidActivity{
<fields>;
<methods>;
}
-keep class com.mopub.common.MoPubBrowser{
<fields>;
<methods>;
}
-keep class com.mopub.mobileads.MraidVideoPlayerActivity{
<fields>;
<methods>;
}
if you integrated Admob,add NativeAd Proguard script
-dontwarn com.google.android.gms.**
-keep class com.google.android.gms.** { *;}
-keep class com.cmcm.adsdk.nativead.AdmobNativeLoader{
<fields>;
<methods>;
}
-keep public class com.google.android.gms.ads.**{
public *;
}
# For old ads classes
-keep public class com.google.ads.**{
public *;
}
# For mediation
-keepattributes *Annotation*
# Other required classes for Google Play Services
# Read more at http://developer.android.com/google/play-services/setup.html
-keep class * extends java.util.ListResourceBundle {
protected Object[][] getContents();
}
-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
public static final *** NULL;
}
-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
@com.google.android.gms.common.annotation.KeepName *;
}
-keepnames class * implements android.os.Parcelable {
public static final ** CREATOR;
}if you integrated Yahoo,add NativeAd Proguard script
-keep class com.flurry.** {*;}
-dontwarn com.flurry.**
-keepattributes *Annotation*,EnclosingMethod
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keep class com.cmcm.adsdk.adapter.MopubNativeAdapter{ *; }
-keep class com.cmcm.adsdk.adapter.FacebookNativeAdapter{ *; }
-keep class com.cmcm.adsdk.adapter.AdmobNativeAdapter{ *; }
-keep class com.cmcm.adsdk.adapter.YahooNativeAdapter{ *; }
# mopub 广告混淆脚本
-keep class com.mopub.nativeads.*{*;}
-keep class com.mopub.common.**{*;}
-keep class com.mopub.network.**{*;}
-dontwarn com.mopub.**
-keep class com.cmcm.adsdk.nativead.MopubNativeAdLoader{
<fields>;
<methods>;
}
-keep class com.mopub.mobileads.MoPubActivity{
<fields>;
<methods>;
}
-keep class com.mopub.mobileads.MraidActivity{
<fields>;
<methods>;
}
-keep class com.mopub.common.MoPubBrowser{
<fields>;
<methods>;
}
-keep class com.mopub.mobileads.MraidVideoPlayerActivity{
<fields>;
<methods>;
}
#for yahoo
-keep class com.cmcm.adsdk.nativead.FlurryNativeLoader{
<fields>;
<methods>;
}
-keep class com.flurry.** { *; }
-dontwarn com.flurry.**
-keepattributes *Annotation*,EnclosingMethod
-keep class com.google.android.gms.ads.** {*;}
-dontwarn com.google.android.gms.ads.**
-keep class com.google.android.gms.** {*;}
-dontwarn com.google.android.gms.**
#for admob
-keep class * extends java.util.ListResourceBundle {
protected Object[][] getContents();
}
-keep class com.google.ads.AdActivity{
<fields>;
<methods>;
}
-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
public static final *** NULL;
}
-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
@com.google.android.gms.common.annotation.KeepName *;
}
-keepnames class * implements android.os.Parcelable {
public static final ** CREATOR;
}
-keep public class com.google.ads.**{
public *;
}##3.add access code in you project when pegasi sdk init.
If you need mopub ads you shuold add this code after pegasi sdk init:
CMAdManager.getFactory().addLoaderClass("mp", "com.cmcm.adsdk.adapter.MopubNativeAdapter");
If you need Facebook ads you should add this code after pegasi sdk init:
CMAdManager.getFactory().addLoaderClass("fb", "com.cmcm.adsdk.adapter.FacebookNativeAdapter");
If you need Admob ads you should add this code after pegasi sdk init:
CMAdManager.getFactory().addLoaderClass("ad", "com.cmcm.adsdk.adapter.AdmobNativeAdapter");
If you need yahoo ads you should add this code after pegasi sdk init:
CMAdManager.getFactory().addLoaderClass("yh", "com.cmcm.adsdk.adapter.YahooNativeAdapter");