53 lines
1.2 KiB
Dart
53 lines
1.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:union_ad_ssgf/flutter_union_ad.dart';
|
|
import 'dart:async';
|
|
import 'package:union_ad_ssgf_example/home_page.dart';
|
|
|
|
void main() {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
runApp(const MyApp());
|
|
}
|
|
|
|
class MyApp extends StatefulWidget {
|
|
const MyApp({super.key});
|
|
|
|
@override
|
|
State<MyApp> createState() => _MyAppState();
|
|
}
|
|
|
|
class _MyAppState extends State<MyApp> {
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
init().then((value) {
|
|
print("<---- { value : $value } ---->");
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return const MaterialApp(
|
|
home: HomePage(),
|
|
);
|
|
}
|
|
|
|
/// 初始化广告 SDK
|
|
Future<bool> init() async {
|
|
bool result = await FlutterUnionAd.register(
|
|
androidId: "1200310001",
|
|
// androidId
|
|
iosId: "1202937154",
|
|
// iosId
|
|
debug: true,
|
|
// 是否显示日志log
|
|
personalized: FlutterTencentadPersonalized.show,
|
|
// 是否显示个性化推荐广告
|
|
channelId: FlutterTencentadChannel.tencent, //渠道id
|
|
);
|
|
print("------>>>> $result");
|
|
print("----->> result: $result");
|
|
debugPrint("广告SDK 初始化${result ? '成功' : '失败'}");
|
|
return result;
|
|
}
|
|
}
|