adpluginx 0.0.4 copy "adpluginx: ^0.0.4" to clipboard
adpluginx: ^0.0.4 copied to clipboard

unlisted

Ads Management Tool For Flutter

adpluginx Stable #

Plugin based on json to monitise your app with google ads, unity ads, facebook ads, applovin ads, ironsource ads.

supported Format #

Format Providers
Banner Content Cell
Native Content Cell
FullScreen Content Cell
Reward Content Cell

Example json #

{
    "adIds":{
        "google":{
          "fullScreen":"ca-app-pub-3940256099942544/4411468910",
          "reward":"ca-app-pub-3940256099942544/6978759866",
          "rewardVideo":"ca-app-pub-3940256099942544/1712485313",
          "appOpen":"ca-app-pub-3940256099942544/5662855259",
          "banner":"ca-app-pub-1855988198800981/8800952855",
          "native":"ca-app-pub-1855988198800981/2427116195"
        },
        "unity":{
            "placementId":"Interstitial_iOS",
            "banner":"Banner_iOS",
            "gameId":"4621832",
            "reward":"Rewarded_iOS",
            "isMediation":true
        },
        "applovin":{
          "banner":"e457a5ef4b17bd96",
          "id":"xiAs_Fs3BiExPelVuawzyDTU2Sy4GL2d6KB1c7C1loiv64T5oquTwRRIJbHC3qO0qRI_65NChIkGy3U2i6rWXn",
          "fullScreen":"f209f63ea86b1e6e",
          "mrec":"a40bb1632e5d08a9"
        },
        "ironSource":{
            "appId":"f15d1fd9"
        },
        "facebook":{
           "fullScreen":"1102898630351375_1102898907018014",
           "reward":"1102898630351375_1111013902873181",
           "banner":""
        }
    },
    "native-heights":1.2,
    "one-signal":"3f397e5c-634f-4bde-a4f1-6044411c8291",
     "0.0.1":{
        "isAdsOn":true,
        "splashScreen":false,
        "maxAdFailCounter":4,
        "isUpdate":false,
        "updateUrl":"https://www.google.com",
        "globalClick":[8],
        "globalBanner":0,
        "globalNative":2,
        "globalFail":{"0": 1, "1": 2, "2": 3, "3": 0,"6":1},
        "screens":{
            "/SplashScreen":{
               "localAdFlag":false,
               "localClick": [8],
               "banner":0,
               "localFail": {"0": 1, "1": 2, "2": 3, "3": 0,"6":1}
            },
            "/home":{
               "localAdFlag":true,
               "localClick": [8],
               "localGridCount":3,
               "isNativeEnable":true,
               "banner":4,
               "native":2,
               "localFail": {"0": 1, "1": 2, "2": 3, "3": 0,"6":1}
            },
          "/spin":{
               "localAdFlag":true,
               "localClick": [8],
               "localFail": {"0": 1, "1": 2, "2": 3, "3": 0,"6":1}
            }
        },
         "actions":{
            "copyBtn":{
               "localAdFlag":false,
               "localClick": [0,8],
               "banner":0,
               "localFail": {"0": 1, "1": 2, "2": 3, "3": 0,"6":1}
            }
        }
     }
}

Add in .podfile #

# Uncomment this line to define a global platform for your project
platform :ios, '13.0'
source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/Unity-Technologies/unity-mediation-cocoapods-prod.git'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
    use_frameworks! :linkage => :static
    use_modular_headers!
    pod 'UnityMediationVungleAdapter'
    pod 'UnityMediationFacebookAdapter'
  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

target 'OneSignalNotificationServiceExtension' do
  use_frameworks! :linkage => :static
  pod 'OneSignalXCFramework', '>= 3.4.3', '< 4.0'
end
post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

SKNetworks #

NativeAdView.xib #

<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
    <device id="retina4_7" orientation="portrait" appearance="light"/>
    <dependencies>
        <deployment version="2048" identifier="iOS"/>
        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
        <capability name="System colors in document resources" minToolsVersion="11.0"/>
        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
    </dependencies>
    <objects>
        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
        <view contentMode="scaleToFill" id="iN0-l3-epB" customClass="GADNativeAdView">
            <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
            <subviews>
                <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="iNa-bH-h1m">
                    <rect key="frame" x="15" y="15.5" width="40" height="40"/>
                    <constraints>
                        <constraint firstAttribute="height" constant="40" id="ICz-3W-FQf"/>
                        <constraint firstAttribute="width" constant="40" id="vY6-8D-xIn"/>
                    </constraints>
                </imageView>
                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Advertiser" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="GTT-Yh-eSq">
                    <rect key="frame" x="63" y="38.5" width="66.5" height="17"/>
                    <fontDescription key="fontDescription" type="system" pointSize="14"/>
                    <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                    <nil key="highlightedColor"/>
                </label>
                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" placeholderIntrinsicWidth="100" placeholderIntrinsicHeight="17" translatesAutoresizingMaskIntoConstraints="NO" id="2Of-AP-0h9">
                    <rect key="frame" x="129.5" y="38.5" width="100" height="17"/>
                    <constraints>
                        <constraint firstAttribute="height" constant="17" id="jBW-Cz-Kyc"/>
                        <constraint firstAttribute="width" constant="100" id="sXk-zk-NI0"/>
                    </constraints>
                </imageView>
                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" verticalCompressionResistancePriority="751" text="Body that is really really long and can take up to two lines or sometimes even more." textAlignment="justified" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PEQ-D9-2Vv">
                    <rect key="frame" x="15" y="63.5" width="350" height="33.5"/>
                    <fontDescription key="fontDescription" type="system" pointSize="14"/>
                    <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                    <color key="highlightedColor" systemColor="labelColor"/>
                </label>
                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="E5w-YA-UY8">
                    <rect key="frame" x="318" y="259.5" width="47" height="34"/>
                    <fontDescription key="fontDescription" type="system" pointSize="18"/>
                    <state key="normal" title="Install">
                        <color key="titleColor" systemColor="systemYellowColor"/>
                        <color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                    </state>
                </button>
                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Price" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ysb-of-cat">
                    <rect key="frame" x="230" y="268" width="33" height="17"/>
                    <fontDescription key="fontDescription" type="system" pointSize="14"/>
                    <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                    <nil key="highlightedColor"/>
                </label>
                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Store" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hwF-UL-Q8H">
                    <rect key="frame" x="273" y="268" width="35" height="17"/>
                    <fontDescription key="fontDescription" type="system" pointSize="14"/>
                    <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                    <nil key="highlightedColor"/>
                </label>
                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" horizontalCompressionResistancePriority="751" text="Headline" textAlignment="justified" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="beR-eV-DX1">
                    <rect key="frame" x="63" y="10" width="297" height="20.5"/>
                    <constraints>
                        <constraint firstAttribute="height" constant="20.5" id="6r8-Hu-d0y"/>
                    </constraints>
                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
                    <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                    <nil key="highlightedColor"/>
                </label>
                <view contentMode="scaleToFill" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="fNp-yu-K4i" customClass="GADMediaView">
                    <rect key="frame" x="37" y="102" width="300" height="150"/>
                    <constraints>
                        <constraint firstAttribute="height" priority="750" constant="150" id="71m-kn-7Ug"/>
                        <constraint firstAttribute="width" constant="250" id="e3T-fD-di4"/>
                    </constraints>
                </view>
                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Ad" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lp1-oz-XOs">
                    <rect key="frame" x="0.0" y="0.0" width="15" height="15"/>
                    <color key="backgroundColor" red="1" green="0.80000001190000003" blue="0.40000000600000002" alpha="1" colorSpace="calibratedRGB"/>
                    <constraints>
                        <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="15" id="Twa-Vk-uWQ"/>
                        <constraint firstAttribute="height" constant="15" id="k8m-kJ-CF5"/>
                    </constraints>
                    <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="11"/>
                    <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                    <nil key="highlightedColor"/>
                </label>
            </subviews>
            <color key="backgroundColor" white="0.15291942848640233" alpha="1" colorSpace="calibratedWhite"/>
            <constraints>
                <constraint firstItem="GTT-Yh-eSq" firstAttribute="leading" secondItem="beR-eV-DX1" secondAttribute="leading" id="0sB-Mk-EU6"/>
                <constraint firstItem="lp1-oz-XOs" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="3lA-qv-Nkc"/>
                <constraint firstItem="Ysb-of-cat" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="3pc-w6-uy1"/>
                <constraint firstItem="PEQ-D9-2Vv" firstAttribute="top" relation="greaterThanOrEqual" secondItem="iNa-bH-h1m" secondAttribute="bottom" id="4S3-p0-z6A"/>
                <constraint firstAttribute="trailing" secondItem="PEQ-D9-2Vv" secondAttribute="trailing" constant="10" id="8U0-Fb-3R7"/>
                <constraint firstItem="iNa-bH-h1m" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="15" id="9WK-zC-xET"/>
                <constraint firstAttribute="trailing" secondItem="beR-eV-DX1" secondAttribute="trailing" constant="15" id="BcE-do-dNl"/>
                <constraint firstItem="lp1-oz-XOs" firstAttribute="left" secondItem="iN0-l3-epB" secondAttribute="left" id="BpX-yC-PZG"/>
                <constraint firstItem="PEQ-D9-2Vv" firstAttribute="top" secondItem="2Of-AP-0h9" secondAttribute="bottom" constant="8" symbolic="YES" id="CCg-xe-cKg"/>
                <constraint firstItem="2Of-AP-0h9" firstAttribute="top" secondItem="beR-eV-DX1" secondAttribute="bottom" constant="8" symbolic="YES" id="ESC-Pe-TXR"/>
                <constraint firstItem="iNa-bH-h1m" firstAttribute="bottom" secondItem="2Of-AP-0h9" secondAttribute="bottom" id="GwM-y0-1du"/>
                <constraint firstItem="beR-eV-DX1" firstAttribute="leading" secondItem="iNa-bH-h1m" secondAttribute="trailing" constant="8" symbolic="YES" id="MRN-dd-Oip"/>
                <constraint firstItem="2Of-AP-0h9" firstAttribute="leading" secondItem="GTT-Yh-eSq" secondAttribute="trailing" id="Med-Nd-wEo"/>
                <constraint firstItem="beR-eV-DX1" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="10" id="Mvs-eV-Wzb"/>
                <constraint firstItem="Ysb-of-cat" firstAttribute="centerY" secondItem="hwF-UL-Q8H" secondAttribute="centerY" id="Rud-i8-Myz"/>
                <constraint firstItem="fNp-yu-K4i" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="TYN-lq-3DK"/>
                <constraint firstItem="fNp-yu-K4i" firstAttribute="top" secondItem="PEQ-D9-2Vv" secondAttribute="bottom" constant="5" id="V0m-hf-6NS"/>
                <constraint firstItem="GTT-Yh-eSq" firstAttribute="centerY" secondItem="2Of-AP-0h9" secondAttribute="centerY" id="YgR-kp-age"/>
                <constraint firstItem="hwF-UL-Q8H" firstAttribute="leading" secondItem="Ysb-of-cat" secondAttribute="trailing" constant="10" id="aLb-sm-wAb"/>
                <constraint firstAttribute="right" relation="greaterThanOrEqual" secondItem="lp1-oz-XOs" secondAttribute="right" constant="20" symbolic="YES" id="czi-qD-IaJ"/>
                <constraint firstAttribute="trailing" secondItem="E5w-YA-UY8" secondAttribute="trailing" constant="10" id="eNM-dN-tvx"/>
                <constraint firstItem="E5w-YA-UY8" firstAttribute="leading" secondItem="hwF-UL-Q8H" secondAttribute="trailing" constant="10" id="f39-vH-KWq"/>
                <constraint firstItem="iNa-bH-h1m" firstAttribute="leading" secondItem="PEQ-D9-2Vv" secondAttribute="leading" id="mof-5F-8vM"/>
                <constraint firstItem="E5w-YA-UY8" firstAttribute="centerY" secondItem="hwF-UL-Q8H" secondAttribute="centerY" id="rNj-VY-YrO"/>
                <constraint firstItem="E5w-YA-UY8" firstAttribute="top" secondItem="fNp-yu-K4i" secondAttribute="bottom" constant="7.5" id="rup-e7-1CR"/>
                <constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="E5w-YA-UY8" secondAttribute="bottom" constant="20" symbolic="YES" id="uEI-XT-igi"/>
            </constraints>
            <connections>
                <outlet property="advertiserView" destination="GTT-Yh-eSq" id="bY8-5O-6fF"/>
                <outlet property="bodyView" destination="PEQ-D9-2Vv" id="Gpd-Q6-Byv"/>
                <outlet property="callToActionView" destination="E5w-YA-UY8" id="RCf-yK-s1x"/>
                <outlet property="headlineView" destination="beR-eV-DX1" id="d1E-ed-yel"/>
                <outlet property="iconView" destination="iNa-bH-h1m" id="gIe-xy-iwm"/>
                <outlet property="mediaView" destination="fNp-yu-K4i" id="624-ZP-L04"/>
                <outlet property="priceView" destination="Ysb-of-cat" id="L6Q-hd-uaJ"/>
                <outlet property="starRatingView" destination="2Of-AP-0h9" id="zCO-9D-S0V"/>
                <outlet property="storeView" destination="hwF-UL-Q8H" id="hRl-23-ce1"/>
            </connections>
            <point key="canvasLocation" x="13.768115942028986" y="-5.6919642857142856"/>
        </view>
    </objects>
    <resources>
        <systemColor name="labelColor">
            <color white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
        </systemColor>
        <systemColor name="systemYellowColor">
            <color red="1" green="0.80000000000000004" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
        </systemColor>
    </resources>
</document>

SingisticNativeAdFactory.swift #

import google_mobile_ads

import UIKit

class SingisticNativeAdFactory : FLTNativeAdFactory {

    func createNativeAd(_ nativeAd: GADNativeAd,
                        customOptions: [AnyHashable : Any]? = nil) -> GADNativeAdView? {
        let nibView = Bundle.main.loadNibNamed("NativeAdView", owner: nil, options: nil)!.first


        let nativeAdView = nibView as! GADNativeAdView

        (nativeAdView.headlineView as! UILabel).text = nativeAd.headline
        nativeAdView.headlineView!.isHidden = nativeAd.headline == nil


        (nativeAdView.bodyView as! UILabel).text = nativeAd.body
        nativeAdView.bodyView!.isHidden = nativeAd.body == nil

        (nativeAdView.callToActionView as! UIButton).setTitle(nativeAd.callToAction, for: .normal)
        nativeAdView.callToActionView!.isHidden = nativeAd.callToAction == nil

        (nativeAdView.iconView as! UIImageView).image = nativeAd.icon?.image
        nativeAdView.iconView!.isHidden = nativeAd.icon == nil

        (nativeAdView.storeView as! UILabel).text = nativeAd.store
        nativeAdView.storeView!.isHidden = nativeAd.store == nil

        (nativeAdView.priceView as! UILabel).text = nativeAd.price
        nativeAdView.priceView!.isHidden = nativeAd.price == nil

        (nativeAdView.advertiserView as! UILabel).text = nativeAd.advertiser
        nativeAdView.advertiserView!.isHidden = nativeAd.advertiser == nil

        nativeAdView.callToActionView?.isUserInteractionEnabled = false

        nativeAdView.nativeAd = nativeAd

        return nativeAdView
    }


}

AppDelegate.swift #

import UIKit
import Flutter
import google_mobile_ads

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    GeneratedPluginRegistrant.register(with: self)
      let listTileFactory = SingisticNativeAdFactory()
          FLTGoogleMobileAdsPlugin.registerNativeAdFactory(
               self, factoryId: "adFactoryExample", nativeAdFactory: listTileFactory)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

Add For Ads Configrations #

<key>NSUserTrackingUsageDescription</key>
<string>This identifier will be used to deliver personalized ads to you.</string>
<key>GADApplicationIdentifier</key>
<string>you ad id</string>
<string>NSAdvertisingAttributionReportEndpoint</string>
<key>https://postbacks-app.com</key>

Ad Network Code ( Full Screen) #

Code Type
0 Google Inter
1 Facebook Inter
2 Unity Inter
3 IronSource Inter
4 Google Reward Normal
5 Google Reward Video
6 Unity Reward Video
7 Unity (without Mediation) Inter
8 Applovin Inter
9 Applovin Reward
-10 No Ad Default Case
Code Type
0 Google
1 Facebook
2 Unity
3 IronSource
4 Applovin
-10 No Ad Default Case

Native AdCodes ( Full Screen) #

Code Type
0 Google
1 Facebook
2 Applovin
-10 No Ad Default Case