Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagedart
R89SDK.setLogLevel(LogLevel.debug); //This is for testing purposes, remove it on prod
R89SDK.setDebug(getLocalFakeData: true); //This is for testing purposes, remove it on prod

addTestingSingleTagData() /* This is a later step */

R89SDK.initialize(
      publisherId: "TestRefinery89ID", /* This is for testing purposes, change it on prod */
      appId: "TestDemoApp", /* This is for testing purposes, change it on prod */
      singleTag: true);

...

Info

In this example an interstitial would be triggered when the button is pressed and when the interstitial is closed the playVideoTrailer() method will be executed.

Adding testing single tag data

Go back to the point where the SDK was initialized at the start of the guide, we are going to test all the transitions, tagged wrappers, and tagged buttons you have placed in the app.

Before the initialization method, we called addTestingSingleTagData() which uses the R89SDK.singleTagConfiguration to add the testing data needed for debugging the SDK.

More info in → Flutter How To Test Single Tag Implementation

Note

When using the SingleTagConfigBuilder you are not going to be able to select the ad units that are for production, they are by default the testing config id in Flutter - Ad Formats.

Code Block
languagedart
void addTestingSingleTagData() {
  R89SDK.singleTagConfiguration
  // Define the initial route name as the main screen
    ..initialRouteName = '/'

  // Configure the main screen with ad placements
    ..addAdScreenConfig(
        adScreenConfig: AdScreenConfig(screenName: '/')
        // Add a banner inside the wrapper with the tag 'main_page_bottom_ad_container'
          ..addBanner(
            tag: 'main_page_bottom_ad_container',
            getAllWithTag: false, // Only use the first tagged wrapper in "/"
            wrapperRelativePositionAfter: true, // Place the ad after the child of R89Tag(child:...)
          )
        // Trigger an interstitial when transitioning from "MainPage" ("/") to "NewsPostDetailPage"
          ..addInterstitial(eventToTrack: 'NewsPostDetailPage')
        // Trigger an interstitial when a child of R89Tag(tag:'play_video_trailer_tag',child:...) is pressed
          ..addInterstitial(eventToTrackButton: 'play_video_trailer_tag')
    );
}