update history:

Version Author Date Description
v1.0.0 junewong 2019-05-29
1. supported reward API.
v1.0.6 junewong 2019-05-30
1. add new callbacks.
1. fixed some issuses;
v1.0.7 junewong 2019-06-06
1. adjusted some analysis events.
v1.1.0 junewong 2019-06-11
1. update isLoaded method.
v1.2.0 junewong 2019-06-18
1. add Unity APIs for new ad ad types: banner, Interstitial and fullscreen video for iOS.
v1.2.1 junewong 2019-06-19
1. update for Android’s banner default settings.
v1.2.2 junewong 2019-06-19
1. fix some issuses for iOS.
v1.2.3 junewong 2019-06-28
1. Add new way for sdk initialization;
1. Support ‘channel’ parameter in config file.
v1.2.4 junewong 2019-06-28
1. fix isusse about error callback in iOS platform.
v1.2.5 junewong 2019-07-08
1. upgrade the ad sdk to v2.1.0.1 for iOS
v1.2.6 junewong 2019-07-22
1. upgrade the ad sdk for Android
v1.2.7 junewong 2019-07-31
1. Add the ad clicking callback.
v1.2.8 junewong 2019-08-09
1. upgrade the analytics sdk to 3.2.1 for iOS;
1. change the rule for checking if loaded ad.
v1.2.9 junewong 2019-08-14
1. add some APIs for user feedback and ratings for iOS;
v1.3.0 junewong 2019-08-15
1. upgrade the analytics sdk to 3.3.4 for Android;
v1.3.6 junewong 2019-10-30
1. support another ad platoform ‘GDT’ for iOS (need additional framework);
1. upgrade the ‘BU’ ad platform to v2.4.6.7 for iOS;
v1.3.6 junewong 2019-10-31
1. update the layout of banner for iOS.
v1.5.2 junewong 2020-02-10
1. add splash ad for androd and ios;
1. upgrade the ‘BU’ ad platform to v2.5.7.2;
1. some new features for ABTest;
v1.5.3 junewong 2020-02-13
1. support to modify the height of banner in json configuration file.
1. NOTE: should add the implements ‘okhttp’ and ‘cardview’ in android project, see ‘Project configuration’ below.
v1.5.5 junewong 2020-02-19
1. ios support the new ad type ‘native express’;

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.zip
    hippo-ad-sdk-cn-unity-1.5.5.unitypackage.zip

Or download it from netdisk:
https://drive.google.com/file/d/1OXdwweu3DD4VNkrUxFFYiRvR-f4n1ash/view?usp=sharing

  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. Integrate Unity plugin of HippoSDK
    Add all the files of hippo_sdk.unitypackage of the downloaded Hippo_SDK.zip into Unity Project

  2. Integrate SDK configuration files
    Add hippo-ads-config.json into the following path under Unity Project

    Assets/StreamingAssets/

The projects in both platforms will contain the .json file.

  1. Ad demonstration
    Please refer to Assets/HippoAdSDKDemo/HippoSDKDemo.cs for actual ad samples

IV. Instructions on using the SDK

1. Initialize SDK

  1. //Register ad event listener
  2. HippoAdSDK.onAdload = new HippoAdSDK.HippoAdLoaded( AdLoaded );
  3. HippoAdSDK.onReward = new HippoAdSDK.HippoRewarded( AdRewarded );
  4. HippoAdSDK.onError = new HippoAdSDK.HippoAdError( AdError );
  5. HippoAdSDK.onClosed = new HippoAdSDK.HippoAdClosed( AdClosed );
  6. HippoAdSDK.registCallBack();
  7. // Initialize sdk, way 1:
  8. // parameters:
  9. // isSuccess: if sdk initiated successfully
  10. // message: the error message.
  11. HippoAdSDK.init((bool isSuccess,string message) => {
  12. Debug.Log("HippoSdk init callback isSuccess:" + isSuccess+", message:"+message);
  13. // next step, start to load ad ...
  14. });
  15. // Initialize sdk, way 2: (No callback, but NOT recommend)
  16. HippoAdSDK.init();

NOTE: Before exploring android project, make sure had add the events ‘onPause’ and ‘onResume’, which descrbed in the section Android Project Configuration .

2. Embed ad

  1. // Create banner ad
  2. HippoAdSDK.createBannerAd( string adUnitId );
  3. // Load interstitial ad
  4. HippoAdSDK.initInterstitialAd( string adUnitId );
  5. // Load rewarded video ad
  6. HippoAdSDK.initRewardedVideoAd( string adUnitId );
  7. // Load fullscreen video ad
  8. HippoAdSDK.initFullScreenVideoAd( string adUnitId );

Notice: Embedded ad will be re-embedded once shown. No manual re-embedding is needed. The ads will be reloaded automatically after each shown.

3. Show ad

  1. // Determine whether an ad is embeded
  2. HippoAdSDK.IsLoadedAd( string adUnitId );
  3. // show banner ad with special position.
  4. HippoAdSDK.showBannerAd( string adUnitId, BannerPosition.BOTTOM );
  5. // hide banner ad
  6. HippoAdSDK.hideBannerAd( string adUnitId );
  7. // show Interstitial ad
  8. HippoAdSDK.showInterstitialAd( string adUnitId );
  9. // show rewarded video ad
  10. HippoAdSDK.showVideoAd( string adUnitId );
  11. // show fullscreen video ad
  12. HippoAdSDK.showFullScreenVideoAd( string adUnitId );

4. Listener callback event

Triggering the ad event will call back the registered event method, e.g.

  1. private void AdLoaded(string adType, string adUnitId)
  2. {
  3. if ( adType == HippoAdSDK.AD_TYPE_BANNER) { // banner ad
  4. // ....
  5. } else if ( adType == HippoAdSDK.AD_TYPE_INTEREST ) { //interstitial ad
  6. // ....
  7. } else if ( adType == HippoAdSDK.AD_TYPE_REWARD ) { //rewarded video ad
  8. // ....
  9. }
  10. }
  11. private void AdRewarded(string adUnitId)
  12. {
  13. // ...
  14. }
  15. private void AdError(string adType, string errorMessage)
  16. {
  17. // ...
  18. }
  19. private void AdClosed(string adType, string adUnitId)
  20. {
  21. // ...
  22. }
  23. private void AdClicked(string adType, string adUnitId)
  24. {
  25. // ...
  26. }

5. Analysis events

All events will be recorded into the analysis platform ‘Umeng.com’ . This is an optional API.

  1. // customEventName : the name of custom event.
  2. // params : the attributes of event (optional).
  3. HippoAdSDK.sendEvent(string customEventName)
  4. HippoAdSDK.sendEvent(string customEventName, Dictionary<string, string> params);

V. Problem with Integrating

1. Problem with main threads.

All the ads callbacks received in Unity code will not work in the UI thread, watch the tool and demo below if need to do something with UI or audio actions.

UnityMainThreadDispatcher-master.zip(8 kB)

V. Project configuration

iOS Project configuration

iOS Project Runtime environment

  • Support iOS 8.X or higher;
  • SDK compiling environment Xcode 9.4, Base SDK 11.1;
  • Architectures supported: i386, x86-64, armv7, armv7s, arm64

After Unity has exported the iOS project, please check the following project configurations:

1. Network permission configuration

All existing SDK APIs support HTTPS, but sometimes the main ad material may be non-HTTPS, and to solve this:
Go to the setting of the project’s plist and expand the Information Property List by clicking the ‘+’
Add App Transport Security Settings. Click the arrow on the left to expand then the ‘+’ on the right to automatically add the option of Allow Arbitrary Loads. Modify its value to ‘YES’

image.png

2. Check whether the following libraries exist, and add if not:

In the project, click TARGETS → Build Phases and locate Link Binary With Libraries. Click ‘+’ and add any dependent library missing from the following:

  • StoreKit.framework
  • MobileCoreServices.framework
  • WebKit.framework
  • MediaPlayer.framework
  • CoreMedia.framework
  • AVFoundation.framework
  • CoreLocation.framework
  • CoreTelephony.framework
  • SystemConfiguration.framework
  • AdSupport.framework
  • CoreMotion.framework
  • libresolv.9.tbd
  • libc++.tbd
  • libz.tbd
  • PhotoKit.framework

3. Add argument in ‘Other Linker Flags’

Go to Build Settings → Other Linker Flags and add the argument “-ObjC”. SDK supports - all_load at the same time.

image.png

Android Project Configuration

Runtime Environment Configuration

  1. add the implements in build.gradle
  1. allprojects {
  2. repositories {
  3. ...
  4. google()
  5. jcenter()
  6. ...
  7. }
  8. }
  9. dependencies {
  10. ...
  11. implementation 'com.android.support:cardview-v7:28.0.0'
  12. implementation 'com.squareup.okhttp3:okhttp:4.3.1'
  13. ...
  14. }

If the error below had occur, should export the android project, and add some configurations:

微信图片_20190428163926.png

Add the multiDex support:

  1. android {
  2. ...
  3. defaultConfig {
  4. ...
  5. multiDexEnabled true
  6. ...
  7. }
  8. ...
  9. }

and the implements:

  1. dependencies {
  2. ...
  3. implementation 'com.android.support:appcompat-v7:28.0.0'
  4. ...
  5. }

For the Hippo Analytics

Need to call the corresponding APIs in each Activity lifeacycle: call HippoAdSdk.OnAppResume(Activity) in the Activity’s onResume (), and call HippoAdSdk. OnAppPause (Activity) in the Activity’s onPause();

If you did not develop with native Android project, call the APIs at the enter/exit location for each page, as shown below:

  1. If work in android project:
  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. }

PS: How to custom the main Activity in uity project, see:
https://docs.unity3d.com/Manual/AndroidUnityPlayerActivity.html

  1. If work in unity project, add the codes in matched events (when App in foreground and background) for the game:
  1. // resume when entering the game
  2. HippoAdSDK.onAppResume();
  3. // resume when exiting the game
  4. HippoAdSDK.onAppPause();

VI. NOTE

1.Test

The ads can only shown in China or Japan. Use a chinese VPN, or build a ipa file so we can help to test it.

Suggest installing a Chinse VPN by searching ‘小马加速’ on AppStore, which can help to visit the Chinese network (free on first 7 days). Try to change region into American or Canadian zone if search nothgin.

2.Error code

Code **
20000 OK.
20001 No ads. (Or may not be in China or Japan?)
40006 The ad unit id is invalid.
40016 The appId is not related to the ad unit id.
40018 The package name is not correct.
40019 The ad type is not related to the ad id.
50001 Server error.

3.Errors

3.1 Error message “found an unexpected mach-o header code 0x72613c21”.

Check the ‘Embedded Binaries’ settings ? Do not add our sdk framework into there.

image.png

3.2 ld: symbol(s) not found for architectrue arm7s

Remove all architectures excpet arm64 in build settings:

image.png