All Projects → vegidio → flutter-appodeal

vegidio / flutter-appodeal

Licence: MIT License
A Flutter plugin to display ads from Appodeal; it supports consent dialog to track users.

Programming Languages

dart
5743 projects
kotlin
9241 projects
swift
15916 projects
ruby
36898 projects - #4 most used programming language
objective c
16641 projects - #2 most used programming language

Projects that are alternatives of or similar to flutter-appodeal

ArminC-uBlock-Settings
⚙️ ArminC's settings for uBlock₀ - remove most of the ads, pop-ups and trackers.
Stars: ✭ 24 (-25%)
Mutual labels:  ads
ioBroker.beckhoff
ioBroker Adapter to Communicate with Beckhoff Automation System over ADS
Stars: ✭ 14 (-56.25%)
Mutual labels:  ads
scte35-threefive
threefive is the highest rated SCTE35 parser, ever. maybe.
Stars: ✭ 75 (+134.38%)
Mutual labels:  ads
bool-expr-indexer
A fast boolean expression index implementation, especially for RTB ad selection. A Go implementation of the core algorithm in paper <Indexing Boolean Expression>
Stars: ✭ 49 (+53.13%)
Mutual labels:  ads
node-ads
NodeJS Twincat ADS protocol implementation
Stars: ✭ 49 (+53.13%)
Mutual labels:  ads
CyberSecurity-Box
Firewall-System based on OpenWRT or Pi-Hole with UnBound, TOR, optional Privoxy, opt. ntopng and opt. Configuration of the AVM FRITZ!Box with Presets for Security and Port-List. Please visit:
Stars: ✭ 20 (-37.5%)
Mutual labels:  ads
re-lmgtfy
Now that lmgtfy.com has ads, all is lost if we don't recreate it.
Stars: ✭ 23 (-28.12%)
Mutual labels:  ads
FB-Ads-Opt-UCB
The easiest way to optimize Facebook Ads using Upper Confidence Bound Algorithm. 💻
Stars: ✭ 23 (-28.12%)
Mutual labels:  ads
FacebookAds
This is an Android app that displays all the Facebook Mobile Ads based on Audience Network SDK. This repo uses all the major ad-types in a separate activity for all the ads.
Stars: ✭ 16 (-50%)
Mutual labels:  ads
hms-ads-demo-java
HUAWEI Ads SDK sample code. HUAWEI Ads SDK provides the banner, native, rewarded, interstitial and splash ad formats for integration.
Stars: ✭ 45 (+40.63%)
Mutual labels:  ads
pihole-blocklists
Domain blocklists for Pi-Hole that are free and open for use by everyone.
Stars: ✭ 13 (-59.37%)
Mutual labels:  ads
GoHole
GoHole is a DNS server written in Golang with the same idea than the PiHole, blocking advertisements's and tracking's domains
Stars: ✭ 28 (-12.5%)
Mutual labels:  ads
kaltura-player-android
Kaltura Player is a rich, easy to integrate and easy to use video player for all media types and ad scenarios you need. - based on Google ExoPlayer
Stars: ✭ 22 (-31.25%)
Mutual labels:  ads
mol-video-ad-sdk
VAST/VPAID SDK that allows video ads to be played on top of any player
Stars: ✭ 17 (-46.87%)
Mutual labels:  ads
Search Ads Web Service
Online search advertisement platform & Realtime Campaign Monitoring [Maybe Deprecated]
Stars: ✭ 30 (-6.25%)
Mutual labels:  ads
facebook-cleaner
Fuzzify.me – A browser extension that cleans out a Facebook user's ad preferences and provides a stream of ads that user receives.
Stars: ✭ 50 (+56.25%)
Mutual labels:  ads
SoftBeckhoff
Virtual Beckhoff PLC for local testing with docker support
Stars: ✭ 40 (+25%)
Mutual labels:  ads
react-native-appodeal
React Native package that adds Appodeal SDK support to your react-native application.
Stars: ✭ 51 (+59.38%)
Mutual labels:  appodeal
admob
Admob for React Native with powerful hooks and components
Stars: ✭ 124 (+287.5%)
Mutual labels:  ads
unbound-dns-firewall
DNS-Firewall Python script for UNBOUND
Stars: ✭ 23 (-28.12%)
Mutual labels:  ads

appodeal_flutter

GitHub Actions Pub Version MIT License

A Flutter plugin to display ads from Appodeal. It currently supports Banner, MREC, Interstitial, Reward and Non-Skippable ads.

Package Archived - Please use the official Appodeal package from now on

This project was created by me when there was no official support for Appodeal on Flutter. But now that the Appodeal team created their own official package I don't see a reason to keep maintaining this one.

I thank everybody that downloaded, contributed with PRs an supported this package.

📽 Demo

Demo

⚙️ Installation

  1. Add the dependency to the pubspec.yaml file in your project:
dependencies:
  appodeal_flutter: # use the latest version
  1. Install the plugin by running the command below in the terminal, in your project's root directory:
$ flutter pub get
  1. Follow the Appodeal installation instructions available for iOS and Android. However, ignore the steps to include the Appodeal SDK dependencies in Gradle (Android) and Cocoapods (iOS) since these steps will be done by this package.

Extra steps for Android only

  1. The Appodeal framework includes mutiple libraries from different ad providers, so it's very likely that the inclusion of this plugin in your project will make it exceed to 64K limit method count of Android. To solve this problem you need to enable multidex in your project; follow the instructions here to learn how to do that.

  2. Your Android project must use Gradle 4.0.1 or greater. If you are using an older version, please upgrade it by editing the file android/build.gradle.

Extra step for iOS 14+ only

  1. Follow the instructions available here to learn how to implement the permission request to track users, but ignore the part to include some code in the AppDelegate file. This code is already included in this plugin and it will be executed when you call the function Appodeal.requestIOSTrackingAuthorization(), before the initialization of Appodeal (see below).

If you don't use AdMob

This plugin comes with all possible ad networks supported by Appodeal enabled by default. I made this decision to give more flexibility to the developers using this project, but this comes with a drawback: if you don't intend to use Google AdMob in your app, then you are still forced to add a fake application ID in your project otherwise AdMob will make the app crash if it doesn't find an ID 😬

To add this fake AdMob ID (again, only if you don't intend to use AdMob, otherwise you should use your real AdMob identifier) you must:

Android

Edit the file android/app/src/main/AndroidManifest.xml and add this into the <application> tag:

<application ...>
    ...
    <meta-data
        android:name="com.google.android.gms.ads.APPLICATION_ID"
        android:value="ca-app-pub-0000000000000000~0000000000" />
    ...
</application>

iOS

Edit the file ios/Runner/Info.plist and add this into the <dict> tag:

<dict>
    ...
    <key>GADApplicationIdentifier</key>
    <string>ca-app-pub-0000000000000000~0000000000</string>
    ...
</dict>

📱 Usage

Import the plugin as early as possible somewhere in your project (ideally in the file main.dart), then initialize the plugin by calling the functions Appodeal.setAppKeys() and Appodeal.initialize():

Initialization

First you need to set the app keys:

// Set the Appodeal app keys
Appodeal.setAppKeys(
  androidAppKey: '<your-appodeal-android-key>',
  iosAppKey: '<your-appodeal-ios-key>',
);

Where androidAppKey and iosAppKey are the keys associated with your app in your Appodeal account. At least one of these keys must be set before the initialization (either Android or iOS), otherwise you will get an error.

Afterwards you can initialize Appodeal with the function:

// Initialize Appodeal
await Appodeal.initialize(
  hasConsent: true,
  adTypes: [AdType.banner, AdType.mrec, AdType.interstitial, AdType.reward, AdType.nonSkippable],
  testMode: true,
  verbose: true,
);

// At this point you are ready to display ads
  • hasConsent (mandatory) you must set either true or false, depending if the user granted access to be tracked in order to received better ads. See section about collecting user consent for more information.

  • adTypes (optional) you must set a list (of type AdType) with all the ad types that you would like to display in your app. If this parameter is undefined or an empty list then no ads will be loaded.

  • testMode (optional) you must set either true or false (default) depending if you are running the ads during development/test or production.

  • verbose (optional) you must set either true or false (default) if you want Appodeal's verbose logs to be visible amongst the Flutter logs.

👮🏾‍♂️ Consent to track the user

Before you initialize the plugin and start displaying ads, you might need to collect the user's consent to be tracked online, depending on his location or the operating system that he is using.

For iOS 14+ only

Since iOS 14+ you are required to request a specific permission before you can have access to Apple's IDFA (a sort of proprietary cookie used by Apple to track users among multiple advertisers... ah Apple, always Apple 🙄). To request this permission call the function Appodeal.requestIOSTrackingAuthorization():

// iOS 14+: request permission to track users
// on iOS <= 13 and Android this function does nothing; it just returns true
await Appodeal.requestIOSTrackingAuthorization();

For iOS versions before 14 and for Android devices this function won't do anything, so it's safe to call it on any device OS or version.

For users protected by GDPR/CCPA privacy laws

Depending on the location of your users, they might be protected by the privacy laws GDPR or CCPA. These laws require, among other things, that app developers must collect user consent before the advertisers can track them online. You can check if the user is protected by any privacy laws, by calling the function Appodeal.shouldShowConsent():

bool shouldShow = await Appodeal.shouldShowConsent();
if (shouldShow) { /* Request user consent */ }

Keep in mind that the function above will also return false if the user previously accepted or declined the request to be tracked online. So it's important to always call this function in advance to avoid annoying the user with permission requests that he already answered.

After you determine if you need to request user consent, you have two options to collect this consent:

  1. You can design the UI with all the legal information and multiple options to let the user decline, accept or partially accept the options to be tracked. After you collect this information yourself, you then need to pass the value true or false to the parameter hasConsent during the Appodeal initialization.

or:

  1. You can use the UI provided by the Consent Manager framework. With this option you can't customize the UI used to collect the user consent, however it does the heavy lifting for you of creating and displaying a window with all the legal wording, permission options and everything that is necessary to get the user's permission to be tracked. If you decide to go with option # 2 then you must call two functions:

    2.1. Call the function Appodeal.requestConsentAuthorization() to display a window requesting the user consent to be tracked:

    await Appodeal.requestConsentAuthorization();

    2.2. After the user grants or decline consent, you can call the function Appodeal.fetchConsentInfo() to fetch the consent info:

    var consent = await Appodeal.fetchConsentInfo();
    var hasConsent = consent.status == ConsentStatus.personalized || consent.status == ConsentStatus.partlyPersonalized;
    await Appodeal.initialize(hasConsent: hasConsent, ...)

💵 Showing ads

After you collect all the permissions and the plugin properly initialized, you are ready to display the ads:

Banner & MREC

To display a banner or MREC ad in your app, just include the widgets AppodealBanner() or AppodealMrec() somewhere in your widget tree. For example:

...
// Add a banner ad
Center(
  child: AppodealBanner()
),
// or a MREC ad
Center(
  child: AppodealMrec()
),
...

Interstitial, Reward & Non-Skippable

To show an interstitial, reward or non-skippable ad, call the function Appodeal.show() passing the type of ad that you would like to show as a paremeter (mandatory) and the placement name (optional):

Appodeal.show(AdType.interstitial, placementName: "placement-name");  // Show an interstitial ad
Appodeal.show(AdType.reward, placementName: "placement-name");        // Show a reward ad
Appodeal.show(AdType.nonSkippable);                                   // Show a non-skippable ad without placement name

♻️ Callbacks

You can define callbacks to your ads and track when an event occurs; it can be done by calling the callback functions below:

  • Appodeal.setBannerCallback((event) {})
  • Appodeal.setMrecCallback((event) {})
  • Appodeal.setInterstitialCallback((event) {})
  • Appodeal.setRewardCallback((event) {})
  • Appodeal.setNonSkippableCallback((event) {})

Every callback carries the parameter event of type String and you can use it to determine what event has been triggered. For example, if I wanted to know when the user watched a reward ad until the end, I could use the following callback code:

Appodeal.setRewardCallback((event) {
  if (event == 'onRewardedVideoFinished') {
    print('The user watched the reward ad until the end');
  }
})

and if later I don't want to track reward events anymore, I just need to pass the value null to the same callback function:

Appodeal.setRewardCallback(null);

The full list of events that you can track is below:

Banner

onBannerLoaded, onBannerFailedToLoad, onBannerShown, onBannerClicked, onBannerExpired.

MREC

onMrecLoaded, onMrecFailedToLoad, onMrecShown, onMrecClicked, onMrecExpired.

Interstitial

onInterstitialLoaded, onInterstitialFailedToLoad, onInterstitialShown, onInterstitialShowFailed, onInterstitialClicked, onInterstitialClosed, onInterstitialExpired.

Reward

onRewardedVideoLoaded, onRewardedVideoFailedToLoad, onRewardedVideoShown, onRewardedVideoShowFailed, onRewardedVideoFinished, onRewardedVideoClosed, onRewardedVideoExpired, onRewardedVideoClicked.

Non-Skippable

onNonSkippableVideoLoaded, onNonSkippableVideoFailedToLoad, onNonSkippableVideoShown, onNonSkippableVideoShowFailed, onNonSkippableVideoFinished, onNonSkippableVideoClosed, onNonSkippableVideoExpired.

🙏🏾 Donations

If you like this project then please consider becoming a sponsor. Your contribution will help me dedicate more time working on bugs and new features for this and other projects.

📝 License

appodeal_flutter is released under the MIT License. See LICENSE for details.

👨🏾‍💻 Author

Vinicius Egidio (vinicius.io)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].