Events

Listen to the AATKit events

There is a bunch of events which informs you about the placement state. For example you can figure out when placement is loaded by registering function to the onHaveAd field of the AATKitBinding object, like:

  @override
  void initState() {
    super.initState();
    _aatKitBinding.onHaveAd = (placementName) {
      print("[Home Page] onHaveAd placementName: $placementName");
    };
  }

Function(String)? onHaveAd

Notifies that placement has finished loading an ad successfully.

  @override
  void initState() {
    super.initState();da
    _aatKitBinding.onHaveAd = (placementName) {
      print("[Home Page] onHaveAd placementName: $placementName");
    };
  }

Function(String)? onNoAd

Notifies that placement has failed to load an ad.

  @override
  void initState() {
    super.initState();
    _aatKitBinding.onNoAd = (placementName) {
      print("[Home Page] onNoAd placementName: $placementName");
    };
  }

Function(String)? onPauseForAd

Notifies that ad went fullscreen and that application should pause.

  @override
  void initState() {
    super.initState();
    _aatKitBinding.onPauseForAd = (placementName) {
      print("[Home Page] onPauseForAd placementName: $placementName");
    };
  }

Function(String)? onResumeAfterAd

Notifies that ad came back from fullscreen and that application should resume.

  @override
  void initState() {
    super.initState();
    _aatKitBinding.onResumeAfterAd = (placementName) {
      print("[Home Page] onResumeAfterAd placementName: $placementName");
    };
  }

Function(AATKitReward)? onUserEarnedIncentive

Notifies that placement has earned incentive (by rewarded ads)

  @override
  void initState() {
    super.initState();
    _aatKitBinding.onUserEarnedIncentive = (reward) {
      print("[Home Page] onUserEarnedIncentive "
          "placementName: ${reward.placementName} "
          "rewardName: ${reward.rewardName} "
          "rewardValue: ${reward.rewardValue} ");
    };
  }

Function(AATKitConsentState)? managedConsentCMPFinished

Notifies that the used CMP has finished updating consent.

  @override
  void initState() {
    super.initState();
    _aatKitBinding.managedConsentCMPFinished = (state) {
      print("[Home Page] managedConsentCMPFinished state: $state");
    };
  }

Function()? managedConsentNeedsUserInterface

Notifies that Managed Consent needs to show a consent dialog.

  @override
  void initState() {
    super.initState();
    _aatKitBinding.managedConsentNeedsUserInterface = () {
      print("[Home Page] managedConsentNeedsUserInterface");
    };
  }

Function(String)? managedConsentCMPFailedToShow

Notifies that the used CMP failed to show.

  @override
  void initState() {
    super.initState();
    _aatKitBinding.managedConsentCMPFailedToShow = (error) {
      print("[Home Page] managedConsentCMPFailedToShow error: $error");
    };
  }

Function(String)? managedConsentCMPFailedToLoad

Notifies that the used CMP failed to load.

  @override
  void initState() {
    super.initState();
    _aatKitBinding.managedConsentCMPFailedToLoad = (error) {
      print("[Home Page] managedConsentCMPFailedToLoad error: $error");
    };
  }

Last updated