I am using Huawei Ads Kit in my project but when I am trying to close InterstitialAd onAdClosed() callback is not triggered here is my code below
Activity activity = ... ;
String adUnitId = ... ;
InterstitialAd ad = InterstitialAd(activity);
ad.setAdUnitId(adUnitId);
ad.setAdListener(new AdListener() {
// ...
@Override public void onAdClosed()
{
// Called when user presses the X button - OK.
// Not called when user pressed the device back button - NOT OK.
}
};
ad.loadAd(...);
// (call when ready)
ad.show();
Is this behavior intentional?
Our app code relies on onAdClosed being called whenever the user closes the interstitial using both actions.
Code tested with:
Huawei P10 running EMUI 9.1.0.252 and HMS Core 4.0.0.334
I tried to replicate your issue, but in my case I'm getting the behavior you're expecting.
If you are using obfuscation, make sure to add this lines to your proguard-rules.pro
-keep class com.huawei.openalliance.ad.** { *; }
-keep class com.huawei.hms.ads.** { *; }
and lastly the documentation states that Ads Kit needs at least HMS Core 4.0.0 to work correctly.
https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/ads-sdk-guide