flutter_unioad is a Flutter plugin that integrates pangolin Android and iOSSDK, which is convenient for directly calling the pangolin SDK method development
flutter_unionad: ^0.0.3
Reference plugin
import 'package:flutter_unionad/flutter_unionad.dart' as FlutterUnionad;
The aar file has been integrated into the plug-in, no additional configuration is required, only AndroidManifest.xml configuration in the android directory
<application
tools:replace="android:label">
SDK version 3.2.0.3
The SDK has been configured in the plug-in, and the rest are configured according to the SDK document. Because PlatformView is used, add it in Info.plist
<key>io.flutter.embedded_views_preview</key>
<true/>
SDK version 3.2.0.1
await FlutterUnionad.register(
androidAppId: "5098580",
iosAppId: "5098580",
useTextureView: true,
appName: "unionad_test",
allowShowNotify: true,
allowShowPageWhenScreenLock: true,
debug: true,
supportMultiProcess: true,
directDownloadNetworkType: [
FlutterUnionad.NETWORK_STATE_2G,
FlutterUnionad.NETWORK_STATE_3G,
FlutterUnionad.NETWORK_STATE_4G,
FlutterUnionad.NETWORK_STATE_WIFI
]);
await FlutterUnionad.getSDKVersion();
await FlutterUnionad.requestPermissionIfNecessary();
Container(
height: 700,
child: FlutterUnionad.splashAdView(
mCodeId: "887367774",
supportDeepLink: true,
mIsExpress: false,
expressViewWidth: 540,
expressViewHeight: 800),
),
Monitor the status of open-screen ads
StreamSubscription _adViewStream = FlutterUnionad.adeventEvent
.receiveBroadcastStream()
.listen((data) {
if (data[FlutterUnionad.adType] == FlutterUnionad.aplashAd) {
if (data[FlutterUnionad.aplashType] == FlutterUnionad.onAplashTimeout) {
print("开屏广告超时 ${FlutterUnionad.onAplashTimeout}");
} else if (data[ FlutterUnionad .aplashType] ==
FlutterUnionad .onAplashShow) {
print ( "On-screen advertising display ${ FlutterUnionad.onAplashShow }" );
} else if (data[ FlutterUnionad .aplashType] ==
FlutterUnionad .onAplashClick) {
print ( "Open the screen ad click ${ FlutterUnionad.onAplashClick }" );
} else if (data[ FlutterUnionad .aplashType] ==
FlutterUnionad .onAplashSkip) {
print ( "Screen opening ads skip ${ FlutterUnionad.onAplashSkip }" );
Navigator . pop (context);
} else if (data[ FlutterUnionad .aplashType] ==
FlutterUnionad .onAplashFinish) {
print ( "The end of the screen advertisement ${ FlutterUnionad.onAplashFinish }" );
Navigator . pop (context);
}
}
});
Container(
height: 200,
child: FlutterUnionad.bannerAdView(
mCodeId: "945410197",
supportDeepLink: true,
expressAdNum: 3,
expressTime: 30,
expressViewWidth: 1080,
expressViewHeight: 400,
),
),
Container(
height: 300,
child: FlutterUnionad.nativeExpressAdView(
mCodeId: "945417699",
supportDeepLink: true,
expressViewWidth: 800,
expressViewHeight: 600,
),
),
Return to native view
FlutterUnionad.interactionExpressAdView(
mCodeId: "945417892",
supportDeepLink: true,
expressViewWidth: 800,
expressViewHeight: 1200,
);
Direct pop-up
FlutterUnionad.interactionExpressAd(
mCodeId: "945417892",
supportDeepLink: true,
expressViewWidth: 800,
expressViewHeight: 1200,
);
FlutterUnionad.loadRewardVideoAd(
mIsExpress: true,
mCodeId: "945418088",
supportDeepLink: true,
rewardName : "100 gold coins" ,
rewardAmount: 100,
userID: "123",
orientation: FlutterUnionad.VideoVERTICAL,
mediaExtra: null);
Monitor rewarded video status
StreamSubscription _adViewStream = FlutterUnionad.adeventEvent
.receiveBroadcastStream()
.listen((data) {
if (data[FlutterUnionad.adType] == FlutterUnionad.rewardAd) {
print("激励广告结果-----> rewardVerify=${data[FlutterUnionad.rewardVerify]} "
"rewardName=${data[FlutterUnionad.rewardName]} "
"rewardAmount=${data[FlutterUnionad.rewardAmount]} ");
}
});
Center(
child: FlutterUnionad.drawFeedExpressAdView(
mCodeId: "945426252",
supportDeepLink: true,
expressViewWidth: 1080,
expressViewHeight: 1920),
);
},
Author: gstory0404
Source Code: https://github.com/gstory0404/flutter_unionad
#flutter #dart #mobile-apps