apsl_ads_flutter_kids

Last updated:

0 purchases

apsl_ads_flutter_kids Image
apsl_ads_flutter_kids Images
Add to Cart

Description:

apsl ads flutter kids

Apsl Ads Flutter Kids #
Please show some ❤️ to the package, give it a 👍, and ⭐️ the repo to support the project!
Simplify the integration of ads from various ad networks into your Flutter app effortlessly.
Features #

Google Mobile Ads (banner, appOpen, interstitial, rewarded ad, native ad)

Admob Mediation #

This plugin offers support for AdMob mediation. See Details for the AdMob Mediation Guide.
Simply add the native platform settings for AdMob mediation.

Platform Specific Setup #
iOS #
Update your Info.plist

The key for Google Ads are required in Info.plist.

Update your app's ios/Runner/Info.plist file to add two keys:
<key>GADApplicationIdentifier</key>
<string>YOUR_SDK_KEY</string>
copied to clipboard

You have to add SKAdNetworkItems for all networks provided by Apsl-ads-flutter info.plist you can copy paste SKAdNetworkItems in your own project.

Android #
Update AndroidManifest.xml
<manifest>
<application>
<!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 -->
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>
</application>
</manifest>
copied to clipboard
Initialize Ad Ids #
import 'dart:io';

import 'ads_id_manager.dart';

class TestAdsIdManager extends AdsIdManager {
const TestAdsIdManager();

@override
List<AppAdIds> get appAdIds => [
AppAdIds(
adNetwork: 'admob',
appId: Platform.isAndroid
? 'ca-app-pub-3940256099942544~3347511713'
: 'ca-app-pub-3940256099942544~1458002511',
appOpenId: Platform.isAndroid
? 'ca-app-pub-3940256099942544/3419835294'
: 'ca-app-pub-3940256099942544/5662855259',
bannerId: Platform.isAndroid
? 'ca-app-pub-3940256099942544/6300978111'
: 'ca-app-pub-3940256099942544/2934735716',
interstitialId: Platform.isAndroid
? 'ca-app-pub-3940256099942544/1033173712'
: 'ca-app-pub-3940256099942544/4411468910',
rewardedId: Platform.isAndroid
? 'ca-app-pub-3940256099942544/5224354917'
: 'ca-app-pub-3940256099942544/1712485313',
nativeId: Platform.isAndroid
? 'ca-app-pub-3940256099942544/2247696110'
: 'ca-app-pub-3940256099942544/3986624511',
),
];
}

copied to clipboard
Initialize the SDK #
Before loading ads, have your app initialize the Mobile Ads SDK by calling ApslAds.instance.initialize() which initializes the SDK and returns a Future that finishes once initialization is complete (or after a 30-second timeout). This needs to be done only once, ideally right before running the app.
Before you start showing ads in your app, make sure to initialize the Mobile Ads SDK by calling ApslAds.instance.initialize(). This will initialize the SDK and return a Future that completes when the initialization is done (or after a 30-second timeout). You only need to do this once, preferably right before running your app.
import 'package:apsl_ads_flutter/apsl_ads_flutter.dart';
import 'package:flutter/material.dart';

const IAdIdManager adIdManager = TestAdIdManager();

ApslAds.instance.initialize(
adIdManager,
adMobAdRequest: const AdRequest(),
admobConfiguration: RequestConfiguration(testDeviceIds: []),
);
copied to clipboard
Interstitial/Rewarded Ads #
Load an ad #
Ad is automatically loaded after being displayed or first time when you call initialize.
As a safety measure, you can call this method to load both rewarded and interstitial ads.
If an ad is already loaded, it won't load again.
ApslAds.instance.loadAd();
copied to clipboard
Show interstitial or rewarded ad #
ApslAds.instance.showAd(AdUnitType.rewarded);
copied to clipboard
Show appOpen ad #
ApslAds.instance.showAd(AdUnitType.appOpen)
copied to clipboard
Show Banner Ads #
This is how you may show banner ad in widget-tree somewhere:
@override
Widget build(BuildContext context) {
Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
SomeWidget(),
const Spacer(),
ApslBannerAd(
adNetwork: AdNetwork.admob, adSize: AdSize.mediumRectangle),
],
);
}
copied to clipboard
Show All Banner Ad one by one #
Banners will attempt to load ad networks in the order you provided. If a network fails to load for any reason, it will automatically move on to the next one to prevent revenue loss.
To set the order for All Banner, simply pass the orderOfAdNetworks parameter in the ApslAllBannerAd constructor like this:
Other wise it will set by default as [admob, facebook, unity] and default AdSize is AdSize.banner,
This is how you may show banner ad in widget-tree somewhere:
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('My App'),
),
body: Column(
children: [
// Your other widgets...
ApslAllBannerAd(
orderOfAdNetworks: [
AdNetwork.admob,
],
adSize: AdSize.largeBanner,
// Other parameters...
),
// Your other widgets...
],
),
);
}
copied to clipboard
Listening to the callbacks #
Declare this object in the class
StreamSubscription? _streamSubscription;
copied to clipboard
The following code snippet demonstrates the process of displaying an interstitial ad and checking if it has been shown:
If true, we are canceling the subscribed callbacks, if any.
Then, we are listening to the Stream and accessing the particular event we need
if (ApslAds.instance.showInterstitialAd()) {
// Canceling the last callback subscribed
_streamSubscription?.cancel();
// Listening to the callback from showInterstitialAd()
_streamSubscription =
ApslAds.instance.onEvent.listen((event) {
if (event.adUnitType == AdUnitType.interstitial &&
event.type == AdEventType.adDismissed) {
_streamSubscription?.cancel();
goToNextScreen(countryList[index]);
}
});
}
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.