-
Notifications
You must be signed in to change notification settings - Fork 4
Getting Started
This document details the process of integrating the PEGASI SDK with your Android application .
Here are the basic integration steps:
1.Obtain the PEGASI SDK source from github(Download PEGASI SDK)
2.Add our SDK(and dependencies) to your project.
3.Create ad units in your app.
##simple introduction Our SDK includes juhe_V3.4_base_world and juhe_V3.4_ext_world , the base package(juhe_V3.4_base_world) only include the Orion(cheetah mobile) source of Ad ,but the extend package(juhe_V3.4_ext_world) not only include the Orion(cheetah mobile) source of Ad but also include facebook , Mopub , Yahoo ,Admob etc third-party source of Ad. So , you can choose the sdk which you need to intergrate . The advertising style includes NativeAd , Native BannerAd and InterstitailAd . ##Download the PEGASI Android SDK You can visit https://github.com/CMAdSDK/android_sdk and download the PEGASI Android SDK . The zip package includes document and demo .
Android 2.3.1(API Version 9) and up
Copy .aar file to libs of project,add code to Gradle script. Open your project's build.gradle file and add the below lines : ####1.PEGASI SDK World Base Version
repositories {
flatDir {
dirs 'libs'
}
}
dependencies {
compile(name: 'cmadsdk_world_base_V3.4.3', ext: 'aar')
}####2.PEGASI SDK World Ext Version
repositories {
flatDir {
dirs 'libs'
}
}
dependencies {
compile(name: 'cmadsdk_world_ext_V3.4.3', ext: 'aar')
//notice:integration Admob need to add these aar
compile(name: 'play-services-ads-7.8.0', ext: 'aar')
compile(name: 'play-services-analytics-7.8.0', ext: 'aar')
compile(name: 'play-services-base-7.8.0', ext: 'aar')
}##Updating your Android Manifest Your AndroidManifest.xml will need to be updated in order to complete the SDK integration. Add the following permissions and activity declarations according to the bundle you are integrating. ####1.PEGASI SDK World Base Version
#####Declare the following permissions:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />**Note:**The INTERNET permission is required which is used to access the internet to get ad. The ACCESS_NETWORK_STATE or ACCESS_WIFI_STATE permission are optional which used for checking whether there is avaible Internet connection(suggest configure them).
####2.PEGASI SDK World Ext Version
#####2.1、Declare the following permissions:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />**Note:**The INTERNET permission is required which is used to access the internet to get ad. The ACCESS_NETWORK_STATE or ACCESS_WIFI_STATE permission are optional which used for checking whether there is avaible Internet connection(suggest configure them).
#####2.2、Configure other information: if you integrated Mopub , Please declare the following activities:
<!--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.3、Important Notes
- If you're compiling against APIs below 13, you should exclude screenSize from the manifest entries.
- Make sure the com.mopub.mobileads.MraidVideoPlayerActivity is added to your manifest. Without it, video ads will not work correctly.
##Proguard Script Add the following script in your proguard script:
-keep class com.cmcm.adsdk.** { *;}#####2.1、NativeAd Proguard script
-dontwarn com.cmcm.adsdk.**
-dontwarn com.cleanmaster.**
-dontwarn com.facebook.ads.**
-keep class com.facebook.ads.**{*;}
-keep class com.cmcm.adsdk.** { *;}
-keep class com.cleanmaster.** { *;}#####2.2、add Mopub Proguard script(if you integrated 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>;
}
#####2.3、Admob Proguard script(if you integrated Admob)
-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;
}#####2.4、Yahoo Proguard script(if you integrated Yahoo)
-keep class com.cmcm.adsdk.nativead.FlurryNativeLoader{
<fields>;
<methods>;
}
keep class com.flurry.** { *; }
dontwarn com.flurry.**
keepattributes *Annotation*,EnclosingMethod
keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
#If you are using the Google Mobile Ads SDK, add the following:
# Preserve GMS ads classes
keep class com.google.android.gms.ads.** { *; }
dontwarn com.google.android.gms.ads.**
#If you are using the Google Play Services
# Preserve GMS classes to enable fetching the Advertising ID
keep class com.google.android.gms.**##Displaying Ads Once you've completed the above steps, you can start displaying ads in your application by following the simple instructions on the Native Ad , the Banner Ad or Interstitial Ad pages.