Wiki
Clone wikishowcase-android / Huawei_support
Support for Huawei devices
General Integration Documentation
Please refer to the general integration instructions given for Android.
Added to this, please find the following instructions specifically for preparing your app for publishing at Huawei's AppGallery.
App preparation
Advised - use Huawei as a platform (from AATKit 2.31.1)
To use Huawei as a platform (instead of standard Android platform), set it in AATKitConfiguration before initializing AATKit like:
AATKitConfiguration config = new AATKitConfiguration(this); //do some other configuration config.setPlatform(AATKitConfiguration.Platform.HUAWEI); AATKit.init(config);
Deprecated, for AATKit versions below 2.31.1 - use different bundle ID
If you are using old AATKit versions and cannot set Huawei as a platform, please
- configure your app project to use a different bundle ID for the Huawei app store (e.g. com.publisher.app.huawei instead of com.publisher.app)
- manually register your app again at AddApptr's dashboard using the new bundle ID
Support for Huawei Advertising ID
AATKit (Android) supports two kinds of Advertising IDs for user reporting purposes:
- the Google Advertising ID (GAID)
- the Huawei Advertising ID (OAID)
If the GAID is available at runtime, AATKit will always use it for reporting (even if the device also supports the OAID). Only if the GAID is not available, AATKit will try to read Huawei Advertising ID (OAID) and use that one instead for reporting.
For Huawei devices not supporting Google Play Services, AATKit can now read the advertising ID provided by Huawei Mobile Services and use it for reporting. To enable this feature, you need to:
- add the
maven { url 'https://developer.huawei.com/repo/' }
repository to your repositories list by editing your mainbuild.gradle
file - add the
implementation 'com.huawei.hms:ads-identifier:3.4.61.302'
dependency
Please note that Google Play Services library is still required when compiling the app.
Ad networks
AATKit will dynamically disable ad networks at runtime that do not work without Google Play Services.
This means that you can put any AATKit ad network into your project without bothering about different use cases (devices with or without Google Play Services).
Optional Huawei Ad Network
AATKit also supports Huawei as an ad network, supporting the following formats:
- banner (sizes: 320x50, 300x250, 728x90, 468x60)
- fullscreen
- rewarded video
- native ads
To add this network, add the following dependency:
implementation 'com.huawei.hms:ads-prime:3.4.61.302'
Huawei native ads
There are also some special requirements for Huawei Native Ads to work correctly:
- The native ad views must be instances of
com.huawei.hms.ads.nativead.NativeView
- The main image view must be an instance of
com.huawei.hms.ads.nativead.MediaView
- You have to register the native ad's subviews that will be used for displaying assets, like
((NativeView) yourNativeView).setTitleView(titleView); ((NativeView) yourNativeView).setMediaView(mediaView); ((NativeView) yourNativeView).setAdSourceView(adSourceVew); ((NativeView) yourNativeView).setCallToActionView(ctaView);
Useful links to Huawei documentations
Updated