gromore_flutter 2.2.2
gromore_flutter: ^2.2.2 copied to clipboard
A GroMore ad mediation plugin for Flutter on Android and iOS, with seven ad formats, multiple ad networks, reward verification, and event callbacks.
Flutter GroMore Ads #
An actively maintained GroMore ad mediation plugin for Flutter, with Android and iOS support, multiple ad formats, event callbacks, and multiple ad network (ADN) configurations.
This is a source-available project. Forks are permitted only for evaluation, testing, fixing issues, and contributing changes back through pull requests. Republishing this project or a modified version as an independent plugin, SDK, package, or competing product is not permitted. See LICENSE, the Chinese explanation, and contribution guidelines.
Features #
- Splash ads.
- Interstitial ads.
- Fullscreen video ads.
- Banner ads.
- Rewarded video ads.
- Native feed ads, including template/Express ads and built-in default styles for self-rendered ads.
- Draw feed ads.
Screenshots #
Requirements #
- Android: minimum SDK 24.
- iOS: 13.0 or later.
Quick Start #
Current plugin version: 2.2.2. Bundled SDKs: Android GroMore 7.8.1.4
and iOS Ads-CN-Beta 7.8.0.5.
1. Add the dependency #
dependencies:
gromore_flutter: ^2.2.2
Run:
flutter pub get
2. Initialize the SDK #
For a standard single-process app, provide the App ID for the current platform:
import 'package:flutter/foundation.dart';
import 'package:gromore_flutter/gromore_flutter.dart';
final result = await GromoreFlutter.instance.initialize(
androidAppId: 'your_android_app_id', // For Android
iosAppId: 'your_ios_app_id' // For iOS
);
Initialization returns an InitResult. Read result.android or result.ios
when you need to display initialization errors.
The following settings have defaults and do not need to be supplied for a standard integration:
androidAppName: Android reads the application name automatically.iosAppName: retained for compatibility with older configurations; the current iOS SDK does not depend on it during initialization.debug: disabled by default.useMediation: enabled by default.enabledAdTypes: all ad formats are enabled by default.enableLog: enabled in Debug builds and disabled in Release builds by default.
To disable optional data collection before the user grants privacy consent, pass the privacy configuration explicitly:
await GromoreFlutter.instance.initialize(
androidAppId: 'your_android_app_id',
iosAppId: 'your_ios_app_id',
privacy: GromorePrivacyConfig.disableAll(),
);
Advanced initialization (optional) #
initialize(...) is a shortcut for standard integrations and handles only
App IDs and privacy configuration. To restrict ad formats, explicitly control
logging, or provide platform-specific options, use init(GromoreConfig(...)):
final result = await GromoreFlutter.instance.init(
const GromoreConfig(
androidAppId: 'your_android_app_id',
iosAppId: 'your_ios_app_id',
// Enable only the ad formats your app uses; all are enabled if omitted.
enabledAdTypes: {
GromoreAdType.splash,
GromoreAdType.rewardVideo,
},
// If omitted, logging is enabled in Debug and disabled in Release.
enableLog: kDebugMode,
enableLogToFile: false,
// Include the following options only when the corresponding platform needs them.
androidOptions: {
'supportMultiProcess': true,
},
iosOptions: {
'mediation': {
'limitPersonalAds': 1,
},
},
),
);
Common configuration fields:
enabledAdTypes: restricts the ad formats that can be loaded; all formats are enabled by default.enableLog: controls console logging.enableLogToFileadditionally enables file logging.debug: controls the native SDK's Debug mode and is independent ofenableLog.useMediation: enables GroMore mediation and defaults totrue.androidOptionsandiosOptions: configure platform-specific capabilities. Do not add them to a standard integration just to make the configuration appear complete.
For privacy controls, multi-process support, and native initialization, see Android setup, iOS setup, and privacy configuration.
3. Load and show an ad #
This example uses a splash ad. For complete examples of every ad format, see ad examples.
final adId = await GromoreSplash.load(
const GromoreSplashConfig(
placementId: 'your_splash_placement_id',
timeoutMillis: 3000,
),
);
final subscription = GromoreSplash.listen(
adId: adId,
callback: GromoreAdCallback(
onShown: (_) => debugPrint('splash shown'),
onClosed: (_) => debugPrint('splash closed'),
onFailed: (event) => debugPrint(
'splash failed: ${event.errorCode} ${event.errorMessage}',
),
),
);
await GromoreSplash.show(adId);
// Cancel the subscription and dispose of the ad when the page is disposed.
await subscription.cancel();
await GromoreSplash.dispose(adId);
See ad examples for all formats and rewarded video
server verification using userId and customData.
Ad Formats #
| Format | API | Embedded view |
|---|---|---|
| Splash | GromoreSplash |
No |
| Interstitial | GromoreInterstitial |
No |
| Fullscreen video | GromoreFullscreenVideo |
No |
| Rewarded video | GromoreReward |
No |
| Banner | GromoreBanner |
Yes |
| Native feed | GromoreFeed |
Yes |
| Draw feed | GromoreDraw |
Yes |
Video and splash ads follow the load -> listen -> show pattern. For banner,
native feed, and Draw feed ads, pass the loaded adId to the corresponding view:
GromoreBannerView(
adId: bannerId,
width: 320,
height: 150,
)
For the complete ad API, callbacks, rendered dimensions, visibility detection, and resource cleanup, see ad examples.
Platform Setup #
Basic Android network permissions and TTFileProvider are merged by the plugin.
You do not need to add them again for a standard integration.
Additional platform configuration is needed only in the following scenarios:
- Android multi-process apps, or apps where the host controls initialization after privacy consent.
- iOS apps using ATT, additional ad networks, or specific system capabilities.
- Android/iOS integrations with third-party ad networks such as Tencent GDT, Baidu, Kuaishou, or AdMob.
Refer to the guides relevant to your integration:
- Android setup, multi-process initialization, and ad networks
- iOS setup, ATT, and ad networks
- Privacy and data collection
Events #
Use GromoreAdCallback to handle ad events:
GromoreAdCallback(
onLoaded: (_) {},
onRendered: (_) {},
onShown: (_) {},
onClicked: (_) {},
onClosed: (_) {},
onCompleted: (_) {},
onSkipped: (_) {},
onRewarded: (_) {},
onFailed: (_) {},
)
Common events:
onLoaded: the ad loaded successfully.onRendered: a template or native feed ad finished rendering.onShown: the ad was displayed.onClosed: the ad was closed, including when a native feed ad is closed.onRewarded: the reward was granted.onFailed: loading or displaying the ad failed.
Frequently Asked Questions #
Is Android Manifest configuration required? #
Not for a standard single-process app. Pass androidAppId in GromoreConfig.
Manifest configuration is needed only for multi-process support, automatic
initialization, or initialization controlled by the native host.
Is ATT required on iOS? #
No. Call requestATT() only when your app needs IDFA or personalized advertising
authorization, and configure NSUserTrackingUsageDescription in Info.plist.
Is the privacy configuration required? #
No. Use GromorePrivacyConfig only when you need to restrict data collection
before the user accepts your privacy policy.
Do I need to configure every ad format? #
No. All ad formats are enabled by default through enabledAdTypes. Provide a
restricted set only when you need to limit the available formats.
How do I integrate a third-party ad network? #
First check the platform-specific SDK, adapter, App ID, permission, and
Info.plist/Manifest requirements. Then follow iOS setup or
Android setup.
For more help, see troubleshooting.
Documentation #
The detailed guides below are in Chinese:
- Full Chinese setup guide
- Android setup and ad networks
- Android native initialization
- iOS setup, ATT, and ad networks
- Privacy configuration
- Ad examples and callbacks
- Logging and debug tools
- Troubleshooting
Release history is available in the Chinese changelog.
License and Contact #
This project uses a custom source-available license. It permits evaluation, testing, and contribution, with restrictions on redistribution and derivative products. Review LICENSE, the Chinese explanation, and contribution guidelines before use.
Contact: xm_sean@163.com.
[WeChat contact QR code]