Flutter_tencentad is a Flutter plug-in integrated with Tencent premium premium advertising Android and iOSSDK. It is convenient to directly call premium premium advertising SDK method for rapid development and plug-in repository

Since You need to put the app on the shelf to use the advertisement, demo cannot be run directly to experience demo

The integration steps

1, pubspec. Yaml

flutter_tencentad: ^0.02.
Copy the code

The introduction of

import 'package:flutter_tencentad/flutter_tencentad.dart';
Copy the code

2, the Android

The SDK(4.380.1250) has been configured. No additional configuration is required in the plug-in. You only need to configure androidmanifest.xml in the Android directory

The < manifest... XMLNS: tools ="http://schemas.android.com/tools"... > < application tools: replace ="android:label">
Copy the code

3, the IOS

The development of

use

1. Initialize the SDK

await FlutterTencentad.register(
  appId: "1200009850".//appid
  debug: true.// Whether to display log files
);
Copy the code

2. Obtain the SDK version

await FlutterTencentad.getSDKVersion();
Copy the code

3. Screen ads

FlutterTencentad.splashAdView(
    / / AD id
    codeId: "4052216802299999".////Set the maximum amount of time it takes for an open screen AD to go from request to display (not the AD exposure time). The value range is [1500, 5000]ms
    fetchDelay: 3000.// AD callback
    callBack: SplashAdCallBack(
    onShow: () {
      print("Open screen advertising display");
    },
    onADTick: (time) {
      print("Open screen AD countdown time remaining$time");
    },
    onClick: () {
      print("Open screen AD click");
    },
    onClose: () {
      print("Open screen ads off.");
      Navigator.pop(context);
    },
      onExpose: () {
      print("Open screen advertising exposure.");
    },
      onFail: (code, message) {
      print("Screen ads fail$code $message"); },),),Copy the code

4. Banner ads

FlutterTencentad.bannerAdView(
    / / AD id
    codeId: "8042711873318113".// AD width unit dp
    viewWidth: 500.// Advertising height unit DP should be 6.4:1
    viewHeight: 100.// AD callback
    callBack: BannerAdCallBack(
        onShow: () {
          print("Banner AD display");
        },
        onFail: (code, message) {
          print("Banner AD error$code $message");
        },
        onClose: () {
          print("Banner ads closed");
        },
        onExpose: () {
          print("Banner AD exposure");
        },
        onClick: () {
          print("Banner AD click"); },),),Copy the code

5. Dynamic feed/banner/video patch ads

FlutterTencentad. ExpressAdView (id / / advertising codeId: "4072918853903023", / / advertising unit dp viewWidth wide: 400, / / advertising high dp viewHeight units: 300, // callBack: ExpressAdCallBack(onShow: () {print(" display dynamic message flow advertisement "); }, onFail: (code, message) {print(" dynamic message stream AD error $code $message"); }, onClose: () {print(" dynamic stream advertising is closed "); }, onExpose: () {print(" expose "); }, onClick: () {print(" AD click "); })),Copy the code

6. Motivate video ads

Preloading motivates video ads

await FlutterTencentad.loadRewardVideoAd(
    / / AD id
    codeId: "5042816813706194",);Copy the code

Display motivational video ads

  await FlutterTencentad.showRewardVideoAd();
Copy the code

Listen for motivational video results

 FlutterTencentAdStream.initAdStream(
      // Incentive advertising
      rewardAdCallBack: RewardAdCallBack(
        onShow: () {
          print("Incentivized advertising display");
        },
        onClick: () {
          print("Incentivize AD clicks");
        },
        onFail: (code, message) {
          print("Incentive advertising fails$code $message");
        },
        onClose: () {
          print("Incentive ads to close.");
        },
        onReady: () async {
          print("Incentivize AD preloading ready");
          await FlutterTencentad.showRewardVideoAd();
        },
        onUnReady: () {
          print("Incentive AD preloading not ready");
        },
        onVerify: (transId) {
          print("Incentive advertising rewards$transId"); },),);Copy the code

7. Interstitial ads

Preload interstitial ads

await FlutterTencentad.loadUnifiedInterstitialAD(
    / / AD id
    codeId: "9062813863614416".// Whether to enable full screen
    isFullScreen: false,);Copy the code

Display interstitial ads

  await FlutterTencentad.showUnifiedInterstitialAD();
Copy the code

Interstitial AD result monitoring

FlutterTencentAdStream.initAdStream(
  interactionAdCallBack: InteractionAdCallBack(
        onShow: () {
          print("Interstitial advertising display");
        },
        onClick: () {
          print("Interstitial AD click");
        },
        onFail: (code, message) {
          print("Interstitial ads fail$code $message");
        },
        onClose: () {
          print("Interstitial ads off.");
        },
        onReady: () async {
          print("Interstitial ads ready to preload");
          await FlutterTencentad.showUnifiedInterstitialAD();
        },
        onUnReady: () {
          print("Interstitial AD preloading not ready"); },),);Copy the code