Google Ads Flutter 插件使用教程

Google Ads Flutter 插件使用教程

googleads-mobile-flutterA Flutter plugin for the Google Mobile Ads SDK项目地址:https://gitcode.com/gh_mirrors/go/googleads-mobile-flutter

1. 项目的目录结构及介绍




googleads-mobile-flutter/


├── android/


├── example/


├── ios/


├── lib/


│   ├── ad_instance_manager.dart


│   ├── ad_manager.dart


│   ├── banner_ad.dart


│   ├── constants.dart


│   ├── google_mobile_ads.dart


│   ├── interstitial_ad.dart


│   ├── native_ad.dart


│   ├── rewarded_ad.dart


│   └── utils.dart


├── pubspec.yaml


└── README.md

android/ios/ 目录包含原生平台的配置和代码。example/ 目录包含插件的使用示例。lib/ 目录包含插件的主要 Dart 代码,包括广告管理、不同类型广告的实现等。pubspec.yaml 是项目的依赖管理文件。README.md 是项目的介绍文档。

2. 项目的启动文件介绍

项目的启动文件是 lib/google_mobile_ads.dart,这是插件的主入口文件,负责初始化和提供广告相关的 API。




// lib/google_mobile_ads.dart


library google_mobile_ads;


 


export 'src/ad_instance_manager.dart';


export 'src/ad_manager.dart';


export 'src/banner_ad.dart';


export 'src/constants.dart';


export 'src/interstitial_ad.dart';


export 'src/native_ad.dart';


export 'src/rewarded_ad.dart';


export 'src/utils.dart';

3. 项目的配置文件介绍

项目的配置文件是 pubspec.yaml,它定义了项目的依赖和其他配置信息。




name: google_mobile_ads


description: Google Mobile Ads for Flutter


version: 0.13.4


homepage: https://github.com/googleads/googleads-mobile-flutter


 


environment:


  sdk: ">=2.12.0 <3.0.0"


 


dependencies:


  flutter:


    sdk: flutter


  flutter_localizations:


    sdk: flutter


  meta: ^1.3.0


 


dev_dependencies:


  flutter_test:


    sdk: flutter


  flutter_lints: ^1.0.0


 


flutter:


  uses-material-design: true

name 是项目的名称。description 是项目的描述。version 是项目的版本号。environment 定义了支持的 Dart SDK 版本。dependencies 列出了项目依赖的其他包。dev_dependencies 列出了开发依赖的包。flutter 部分包含 Flutter 相关的配置。

googleads-mobile-flutterA Flutter plugin for the Google Mobile Ads SDK项目地址:https://gitcode.com/gh_mirrors/go/googleads-mobile-flutter

© 版权声明

相关文章

暂无评论

您必须登录才能参与评论!
立即登录
暂无评论...