update history:

Version Author Date Description
v1.1.4 heyy 2019-07-19
1. ;

I. Introduction

This SDK is applied to accessing the advertisement monetizing platform in China, and ensures high efficiency and low maintenance cost with simple procedures to use the advertisement platform and its integrated analysis tools.

II. Preparation

  1. Download Hippo_SDK.zip file for HippoSDK:

hippo-sdk-cn-v1.1.4.zip

  1. Acquire the following configuration file from Hippo operational staff:

hippo-ads-config.json.It contains information including those related to advertisement. Please do not modify it.

  1. Hippo-SDK has already included the Chinese SDK of Umeng. If the developer has used Umeng SDK before and encounters jar conflict, please delete umeng-analytics-xxx.jar and umeng-common-xxx.jar from your Umeng Analytics.

III. Procedures

  1. Import aar package of HippoSDK

Import all the aar packages downloaded into the Android Project and add dependency;

  1. Import SDK configuration file

Import hippo-ads-config.json into the following directory under the Android project ( Create the ASSETS folder if it’s not there. Do not modify the name of the json file):

src/main/assets/hippo-ads-config.json

IV. Instructions on using the SDK

Hippo-Ad-SDK

1. Initialize SDK

  1. HippoAdSdk.init(Context);

2. Set ad event listener

  1. HippoAdSdk.setAdsListener(new HippoAdsListener());
  2. public class HippoAdsListener implements IAdsListener {
  3. @Override
  4. public void hippoAdsLoaded(String hippoAdsId, String adsType) {
  5. Log.d("hippo_sdk", "MainActivity adsType:" + adsType + " Successfully loaded");
  6. }
  7. @Override
  8. public void hippoAdsShown(String hippoAdsId, String adsType) {
  9. Log.d("hippo_sdk", "MainActivity adsType:" + adsType + " Successfully shown");
  10. }
  11. @Override
  12. public void hippoAdsClicked(String hippoAdsId, String adsType) {
  13. Log.d("hippo_sdk", "MainActivity adsType:" + adsType + " Successfully clicked");
  14. }
  15. @Override
  16. public void hippoAdsClosed(String hippoAdsId, String adsType) {
  17. Log.d("hippo_sdk", "MainActivity adsType:" + adsType + " Successfully closed");
  18. }
  19. @Override
  20. public void hippoAdsVideoComplete(String hippoAdsId, String adsType) {
  21. Log.d("hippo_sdk", "MainActivity adsType:" + adsType + " Reward");
  22. }
  23. @Override
  24. public void hippoAdsError(String hippoAdsId, String adsType, int code, String message) {
  25. Log.d("hippo_sdk", "MainActivity adsType:" + adsType + " Loading failed errCode:" + code + ", message:" + message);
  26. }
  27. }

3. Load ads

  1. // Load reward video ads
  2. HippoAdSdk.loadRewardVideoAds(string adUnitId);
  3. // Load full-screen video ads
  4. HippoAdSdk.loadFullScreenVideoAds(string adUnitId);
  5. // Load banner ads
  6. // various dimensions of banner adds are supported:600*300,600*400,600*500,600*260,600*90,600*150,640*100,690*388
  7. HippoAdSdk.loadBannerAds(String hippoAdsId, int width, int height);
  8. // Load Interstitial ads
  9. HippoAdSdk.loadInterstitialAds(String hippoAdsId);

Notice: Only one load upon using is needed. The loaded ads will be automatically re-loaded once shown. It’s not necessary to repeatedly call the loading method.

4. Show ads

  1. // Better see whether ads are loaded in advance
  2. HippoAdSDK.isLoaded( string adUnitId );
  3. // Show reward video ads
  4. HippoAdSdk.showRewardVideoAds(string adUnitId, Context context);
  5. // Show full-screen video ads
  6. HippoAdSdk.showFullScreenVideoAds(string adUnitId, Context context);
  7. // Show banner ads
  8. // Currently only supports showing banners ads on top(BannerPosition.TOP)or at the bottom(BannerPosition.BOTTOM)
  9. HippoAdSdk.showBannerAds(Activity context, String adUnitId, BannerPosition position);
  10. // Show interstitial ads
  11. HippoAdSdk.showInterstitialAds(String hippoAdsId, Activity context);

5. Data statistics (required)

Our corresponding APIs should be called in the life cycle method of each Activity: call HippoAdSdk.onAppResume(activity) in onResume() of Activity, call HippoAdSdk.onAppPause(activity) in onPause() of Activity, and call the corresponding function at entering / exiting every page if not Android Native Development is used, for example:

  1. public class MainActivity extends AppCompatActivity {
  2. …………
  3. @Override
  4. protected void onResume() {
  5. super.onResume();
  6. HippoAdSdk.onAppResume(this);
  7. }
  8. @Override
  9. protected void onPause() {
  10. super.onPause();
  11. HippoAdSdk.onAppPause(this);
  12. }
  13. …………
  14. }

6. Umeng custom events

This SDK supports the custom events of Umeng Statistics. Calling method is:

  1. /**
  2. * context:the context of current state
  3. * event:name of the event(in line with the naming of Umeng Statistics event)
  4. * map:including the property of the reported event
  5. */
  6. HippoReport.sendCustomEvent(Context context, String event, Map<String, String> map)

Hippo-Recorder-SDK (optional)

1. Initialize recorder SDK

  1. HippoAdSdk.initRecorder(this, new IRecordListener() {
  2. @Override
  3. public void onEveryplayShown() {
  4. }
  5. @Override
  6. public void onEveryplayHidden() {
  7. }
  8. @Override
  9. public void onEveryplayReadyForRecording(int resultCode) {
  10. // Recording is ready if resultCode is 1
  11. }
  12. @Override
  13. public void onEveryplayRecordingStarted() {
  14. // Recording starts
  15. }
  16. @Override
  17. public void onEveryplayRecordingStopped() {
  18. // Recording stops
  19. }
  20. @Override
  21. public void onEveryplayThumbnailReadyAtTextureId(int i, int i1) {
  22. }
  23. @Override
  24. public void onFileReady(String videoPath) {
  25. // Go back to the directory of the video when recording stops
  26. }
  27. });

2. Start and stop recording

  1. // Start recording
  2. HippoAdSdk.startRecorder();
  3. // Stop recording
  4. HippoAdSdk.stopRecorder();

Hippo-Share-SDK (optional)

1. Calling method

  1. // See whether certain platform is supported to share to
  2. HippoAdSdk.isSupported(Context context, SharePlatform platform);
  3. // Config sharing content
  4. ShareContentInfo shareContentInfo = new ShareContentInfo();
  5. // Config saving directory of the video to share
  6. shareContentInfo.setFilePath(mRecordVideoPath);
  7. /**
  8. * SharePlatform: platform to share to
  9. * ShareType: type of the content to share
  10. * ShareContentInfo: content to share
  11. * shareHandler: related to callback(need setBackClassName to set the full directory (under the Package name) of the Activity of Interface back from sharing, setListener set the callback)
  12. */
  13. HippoAdSdk.share(Activity activity, SharePlatform platform, ShareType type, ShareContentInfo shareContentInfo, HPShareHandler shareHandler);

V. Obfuscation

No obfuscation is set in this SDK. If the accessed project has enabled obfuscation, please config the following codes into the obfuscation file:

  1. # hippo-sdk(required)
  2. -keep class com.hippo.ads.**{*;}
  3. -keep class com.hippo.ads.**
  4. -dontwarn com.hippo.ads.**
  5. -keeppackagenames com.hippo.ads.**
  6. # jrtt-sdk(required)
  7. -keep class com.bytedance.sdk.openadsdk.** { *; }
  8. -keep public interface com.bytedance.sdk.openadsdk.downloadnew.** {*;}
  9. -keep class com.androidquery.** {*;}
  10. -keep class com.androidquery.**
  11. -dontwarn com.androidquery.**
  12. -keeppackagenames com.androidquery.**
  13. -keep class com.ss.android.**{*;}
  14. -keep class com.ss.android.**
  15. -dontwarn com.ss.android.**
  16. -keeppackagenames com.ss.android.**
  17. # umeng-sdk(required)
  18. -keep class com.umeng.commonsdk.**{*;}
  19. -keep class com.umeng.commonsdk.**
  20. -dontwarn com.umeng.commonsdk.**
  21. -keeppackagenames com.umeng.commonsdk.**
  22. # recorder-sdk(required if accessed)
  23. -keep class com.everyplay.Everyplay.**{*;}
  24. -keep class com.everyplay.Everyplay.**
  25. -dontwarn com.everyplay.Everyplay.**
  26. -keeppackagenames com.everyplay.Everyplay.**

VI. Troubleshooting

1. If errors such as certain methods missing arereported, please config like the following:

微信图片_20190428163926.png

Two places in build.gradle need configuration:

  • Config merging method

    android {
    ...
    defaultConfig {
       ...
       multiDexEnabled true
       ...
    }
    ...
    }
    
  • Add dependency

    implementation 'com.android.support:appcompat-v7:28.0.0'