Last updated:
0 purchases
mintegralad
Mintegral广告 Flutter版本 #
官方文档 #
Android
IOS
版本更新 #
更新日志
本地开发环境 #
[✓] Flutter (Channel stable, 3.0.4, on macOS 12.5 21G72 darwin-x64, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc1)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] IntelliJ IDEA Ultimate Edition (version 2022.1.1)
[✓] VS Code (version 1.69.2)
[✓] Connected device (3 available)
[✓] HTTP Host Availability
copied to clipboard
集成步骤 #
1、pubspec.yaml
mintegralad: ^0.0.2
copied to clipboard
引入
import 'package:flutter/material.dart';
copied to clipboard
使用 #
1、SDK初始化 #
await Mintegralad.register(
//androidId
androidId: "153806",
//iosId
iosId: "153806",
//androidAppKey
androidAppKey: "5ed0c480e4182fc44b2cc3064a2b6b32",
//iosAppKey
iosAppKey: "5ed0c480e4182fc44b2cc3064a2b6b32",
//是否显示日志log
debug: true,
//是否显示个性化推荐广告
personalized: true,
);
copied to clipboard
2、获取SDK版本 #
await Mintegralad.getSDKVersion();
copied to clipboard
3、信息流广告 #
MintegralAdNativeWidget(
//android 广告版位ID
androidId: "352221",
//android 广告单元的ID
androidUnitId: "1588294",
//ios 广告版位ID
iosId: "352221",
//ios 广告单元的ID
iosUnitId: "1588294",
//广告宽
width: 400,
//广告高 加载成功后会自动修改为sdk返回广告高
height: 100,
//广告回调
callBack: MintegralAdNativeCallBack(
onShow: () {
print("信息流广告显示");
},
onClose: () {
print("信息流广告关闭");
},
onFail: (message) {
print("信息流广告出错 $message");
},
onClick: () {
print("信息流广告点击");
},
),
),
copied to clipboard
4、横幅广告 #
MintegralAdBannerWidget(
//android 广告版位ID
androidId: "549920",
//android 广告单元的ID
androidUnitId: "1982590",
//ios 广告版位ID
iosId: "549920",
//ios 广告单元的ID
iosUnitId: "1982590",
//广告宽
width: 400,
//广告高 加载成功后会自动修改为sdk返回广告高
height: 100,
//自动刷新时间(以秒为单位)设置在10s〜180s的范围内。
refreshTime: 30,
//广告回调
callBack: MintegralAdBannerCallBack(
onShow: () {
print("横幅广告显示");
},
onClose: () {
print("横幅广告关闭");
},
onFail: (message) {
print("横幅广告出错 $message");
},
onClick: () {
print("横幅广告点击");
},
),
),
copied to clipboard
5、激励广告 #
预加载广告
await Mintegralad.loadRewardAd(
//android 广告版位ID
androidId: "351457",
//android 广告单元的ID
androidUnitId: "1589582",
//ios 广告版位ID
iosId: "351457",
//ios 广告单元的ID
iosUnitId: "1589582",
//奖励id
rewardId: "12",
//用户id
userId: "123",
);
copied to clipboard
显示广告
await Mintegralad.showRewardAd();
copied to clipboard
广告监听
MintegralAdStream.initAdStream(
//激励广告
rewardCallBack: MintegralAdRewardCallBack(
onShow: () {
print("激励广告显示");
},
onClick: () {
print("激励广告点击");
},
onFail: (message) {
print("激励广告失败 $message");
},
onClose: () {
print("激励广告关闭");
},
onReady: () async {
print("激励广告预加载准备就绪");
await Mintegralad.showRewardAd();
},
onUnReady: () {
print("激励广告预加载未准备就绪");
},
onVerify: (converted, rewardId,rewardName, rewardAmount) {
print("激励广告奖励 是否完整播放=$converted 奖励id=$rewardId 奖励名称=$rewardName 奖励数量=$rewardAmount");
},
),
);
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.