All Projects → appodeal → react-native-appodeal

appodeal / react-native-appodeal

Licence: other
React Native package that adds Appodeal SDK support to your react-native application.

Programming Languages

java
68154 projects - #9 most used programming language
objective c
16641 projects - #2 most used programming language
typescript
32286 projects
ruby
36898 projects - #4 most used programming language
Starlark
911 projects
javascript
184084 projects - #8 most used programming language
swift
15916 projects

Projects that are alternatives of or similar to react-native-appodeal

vite-plugin-radar
All in one analytics loader for vite
Stars: ✭ 64 (+25.49%)
Mutual labels:  advertising
partner-bot
Automates partnerships in the big community of discord.
Stars: ✭ 119 (+133.33%)
Mutual labels:  advertising
MetaHeac
This is an official implementation for "Learning to Expand Audience via Meta Hybrid Experts and Critics for Recommendation and Advertising"(KDD2021).
Stars: ✭ 36 (-29.41%)
Mutual labels:  advertising
CoinHive
A nice friendly simple and easly customizable GUI for coinhives javascript miner to embed onto websites so users of your site can interact with features of the miner on every single page this javascript miner is to help those who have problems with advertisements/advertising/ads popups banners mobile redirects malvertising/malware etc and provid…
Stars: ✭ 58 (+13.73%)
Mutual labels:  advertising
discourse-adplugin
Official Discourse Advertising Plugin. Install & Start Serving Ads on Your Discourse Forum
Stars: ✭ 115 (+125.49%)
Mutual labels:  advertising
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 (-3.92%)
Mutual labels:  advertising
tag-manager
Website analytics, JavaScript error tracking + analytics, tag manager, data ingest endpoint creation (tracking pixels). GDPR + CCPA compliant.
Stars: ✭ 279 (+447.06%)
Mutual labels:  advertising
easy-adwords
EasyAdWords is an easy-to-use wrapper library for simple reporting and entity operations for Google AdWords.
Stars: ✭ 16 (-68.63%)
Mutual labels:  advertising
Multi-task-Conditional-Attention-Networks
A prototype version of our submitted paper: Conversion Prediction Using Multi-task Conditional Attention Networks to Support the Creation of Effective Ad Creatives.
Stars: ✭ 21 (-58.82%)
Mutual labels:  advertising
HouseAds2
A library ( V2 ) for cross promoting own apps within own apps - for Android
Stars: ✭ 23 (-54.9%)
Mutual labels:  advertising
TeadsSDK-iOS
Teads SDK iOS Sample App - Check out an open-source sample of the Teads iOS SDK implementation
Stars: ✭ 22 (-56.86%)
Mutual labels:  advertising
campaign-manager
The Camapign Management UI for RTB4Free, the open source bidder / DSP.
Stars: ✭ 24 (-52.94%)
Mutual labels:  advertising
ads
Allows you to configure ads in several locations
Stars: ✭ 17 (-66.67%)
Mutual labels:  advertising
BidMachine-Android-SDK
Build direct relationships with demand partners and access higher prices and quality demand without obstacles
Stars: ✭ 22 (-56.86%)
Mutual labels:  advertising
kakao-ad-android
No description or website provided.
Stars: ✭ 18 (-64.71%)
Mutual labels:  advertising
affiliate
Add affiliation tags to links automatically in the browser
Stars: ✭ 77 (+50.98%)
Mutual labels:  advertising
click-through-rate-prediction
📈 Click-Through Rate Prediction using Logistic Regression and Tree Algorithms
Stars: ✭ 60 (+17.65%)
Mutual labels:  advertising
TorchBlocks
A PyTorch-based toolkit for natural language processing
Stars: ✭ 85 (+66.67%)
Mutual labels:  advertising
impression
👀Element view notifier
Stars: ✭ 77 (+50.98%)
Mutual labels:  advertising
edgekit
Open source, privacy focused client side library for the creation and monetisation of online audiences.
Stars: ✭ 42 (-17.65%)
Mutual labels:  advertising

react-native-appodeal

React Native package that adds Appodeal SDK support to your react-native application.

Table of Contents

Installation

Run following commands in project root directory

$ npm install react-native-appodeal --save

If you are using React Native version lower than 0.60 run following command:

$ react-native link react-native-appodeal

iOS

  1. Go to ios/ folder and open Podfile
  2. Add Appodeal adapters. Add pods into ./ios/Podfile:
target 'App' do
    config = use_native_modules!

    use_react_native!(
        :path => config[:reactNativePath],
        :hermes_enabled => false
    )

    pod 'APDAdColonyAdapter'
    pod 'APDAmazonAdsAdapter'
    pod 'APDAppLovinAdapter'
    pod 'APDBidMachineAdapter'
    pod 'APDFacebookAudienceAdapter'
    pod 'APDGoogleAdMobAdapter'
    pod 'APDIronSourceAdapter'
    pod 'APDMyTargetAdapter'
    pod 'APDOguryAdapter'
    pod 'APDUnityAdapter'
    pod 'APDVungleAdapter'
    pod 'APDYandexAdapter'

    target 'AppTests' do
        inherit! :complete
    end

    use_native_modules!
    use_frameworks!
end

You can change following implementation to use custom mediation setup. See docs.

Note. Appodeal requires to use use_frameworks! . You need to remove Flipper dependency from Podfile and AppDelegate

  1. Run pod install
  2. Open .xcworkspace
  3. Configfure info.plist . Press Add+ at the end of the name App Transport Security Settings key and choose Allow Arbitrary Loads. Set its type to Boolean and its value to Yes.
<key>NSAppTransportSecurity</key>
<dict>
  <key>NSAllowsArbitraryLoads</key>
  <true/>
</dict>

Add GADApplicationIdentifier key (if you use Admob adapter).

<key>GADApplicationIdentifier</key>
<string>YOUR_ADMOB_APP_ID</string>

For more information about Admob sync check out our FAQ.

  1. Run your project ( Cmd+R )

Android

  1. Add Appodeal adapters.

Add dependencies into build.gradle (module: app)

dependencies {
    ...
    implementation 'com.appodeal.ads:sdk:2.11.0.+'
    ...
}

Add repository into build.gradle (module: project)

allprojects {
    repositories {
        ...
        jcenter()
        maven { url "https://artifactory.appodeal.com/appodeal" }
        ...
    }
}

Note. You can change following implementation to use custom mediation setup. See Docs

  1. Enable multidex

In build.gradle (module: app)

defaultConfig {
    ...
    multiDexEnabled true
    ...
}
...
dependencies {
    ...
    implementation 'com.android.support:multidex:1.0.3'
    ...
}
  1. Set all required permissions in AndroidManifest.xml. See Docs
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
  1. Network security configuration

Add the Network Security Configuration file to your AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest>
    <application 
		...
        android:networkSecurityConfig="@xml/network_security_config">
    </application>
</manifest>

In your network_security_config.xml file, add base-config that sets cleartextTrafficPermitted to true :

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true">
        <trust-anchors>
            <certificates src="system" />
            <certificates src="user" />
        </trust-anchors>
    </base-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">127.0.0.1</domain>
    </domain-config>
</network-security-config>
  1. Admob Configuration (if you use Admob adapter)
<manifest>
    <application>
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="[ADMOB_APP_ID]"/>
    </application>
</manifest>

For more information about Admob sync check out our FAQ.

Usage

Please, read iOS and Android docs at wiki to get deeper understanding how Appodeal SDK works.

Initialisation

  1. Initialise Appodeal at application launch.
import {
    Appodeal,
    AppodealAdType
} from 'react-native-appodeal';

const adTypes = AppodealAdType.INTERSTITIAL | AppodealAdType.REWARDED_VIDEO | AppodealAdType.BANNER;
const consent = true;
Appodeal.initialize('Your app key', adTypes, consent)
  1. Configure SDK
  • General configuration
import {
    Appodeal,
    AppodealAdType,
    AppodealLogLevel,
} from 'react-native-appodeal';
// Set ad auto caching enabled or disabled
// By default autocache is enabled for all ad types
// Call this method before or after initilisation
Appodeal.setAutoCache(AppodealAdType.INTERSTITIAL, false);
// Set testing mode
// Call this method before initilisation
Appodeal.setTesting(bool);
// Set Appodeal SDK logging level
// Call this method before initilisation
Appodeal.setLogLevel(AppodealLogLevel.DEBUG);
// Enable or disable child direct threatment
// Call this method before initilisation
Appodeal.setChildDirectedTreatment(false);
// Disable network for specific ad type:
// Call this method before initilisation
Appodeal.disableNetwork("some_network ", AppodealAdType.INTERSTITIAL);
// Enable or disable triggering show for precache ads
// Call this method before or after initilisation
Appodeal.setOnLoadedTriggerBoth(true);
  • Segments and targeting.
import {
    Appodeal,
    AppodealGender
} from 'react-native-appodeal';
// Set user age
// Call this method before or after initilisation
Appodeal.setAge(25);
// Set user gender
// Supported values are male | female
// Call this method before of after initilisation
Appodeal.setGender(AppodealGender.FEMALE);
// Set specific user id from attribution system
// Call this method before initilisation
Appodeal.setUserId('some user ud')
// Set segment filter
// Call this method before of after initilisation
Appodeal.setSegmentFilter({
    "levels_played": levelsPlayed,
    "player_rank": "gold",
    "paid": false
})
// Set extras
Appodeal.setExtras({
    "attribuition_id": "some value",
})
  • Banner specific
import {
    Appodeal
} from 'react-native-appodeal';
// Enable or disable tablet banners.
// Call this method before of after initilisation
Appodeal.setTabletBanners(false);
// Enable or disable smart banners.
// iOS smart banners are supported only 
// for applications where autoration is disabled
// Call this method before of after initilisation
Appodeal.setSmartBanners(false);
// Enable or disable banner refresh animation
// Call this method before of after initilisation
Appodeal.setBannerAnimation(true);
// Enable or disable banner backgound
// Call this method before of after initilisation
Appodeal.setBannerBackground(true);
  • Android specific
import {
    Appodeal
} from 'react-native-appodeal';
// Mute calls if calls muted on Android
// Call this method before initilisation
Appodeal.muteVideosIfCallsMuted(bool);

Callbacks

Set callbacks listener to get track of ad lifecycle events.

  1. Banner
import {
    Appodeal,
    AppodealBannerEvent
} from 'react-native-appodeal';

Appodeal.addEventListener(AppodealBannerEvent.LOADED, (event: any) =>
    console.log("Banner loaded. Height: ", event.height + ", precache: " + event.isPrecache)
)
Appodeal.addEventListener(AppodealBannerEvent.SHOWN, () =>
    console.log("Banner shown")
)
Appodeal.addEventListener(AppodealBannerEvent.EXPIRED, () =>
    console.log("Banner expired")
)
Appodeal.addEventListener(AppodealBannerEvent.CLICKED, () =>
    console.log("Banner clicked")
)
Appodeal.addEventListener(AppodealBannerEvent.FAILED_TO_LOAD, () =>
    console.log("Banner failed to load")
)
  1. Interstitial
import {
    Appodeal,
    AppodealInterstitialEvent
} from 'react-native-appodeal';

Appodeal.addEventListener(AppodealInterstitialEvent.LOADED, (event: any) =>
    console.log("Interstitial loaded. Precache: ", event.isPrecache)
)
Appodeal.addEventListener(AppodealInterstitialEvent.SHOWN, () => {
    console.log("Interstitial shown")
})
Appodeal.addEventListener(AppodealInterstitialEvent.EXPIRED, () =>
    console.log("Interstitial expired")
)
Appodeal.addEventListener(AppodealInterstitialEvent.CLICKED, () =>
    console.log("Interstitial clicked")
)
Appodeal.addEventListener(AppodealInterstitialEvent.CLOSED, () =>
    console.log("Interstitial closed")
)
Appodeal.addEventListener(AppodealInterstitialEvent.FAILED_TO_LOAD, () =>
    console.log("Interstitial failed to load")
)
Appodeal.addEventListener(AppodealInterstitialEvent.FAILED_TO_SHOW, () =>
    console.log("Interstitial failed to show")
)
  1. Rewarded video
import {
    Appodeal,
    AppodealRewardedEvent
} from 'react-native-appodeal';

Appodeal.addEventListener(AppodealRewardedEvent.LOADED, (event: any) =>
    console.log("Rewarded video loaded. Precache: ", event.isPrecache)
)
Appodeal.addEventListener(AppodealRewardedEvent.SHOWN, () =>
    console.log("Rewarded video shown")
)
Appodeal.addEventListener(AppodealRewardedEvent.EXPIRED, () =>
    console.log("Rewarded video expired")
)
Appodeal.addEventListener(AppodealRewardedEvent.REWARD, (event: any) =>
    console.log("Rewarded video finished. Amount: ", event.amount + ", currency: " + event.currency)
)
Appodeal.addEventListener(AppodealRewardedEvent.CLOSED, (event: any) =>
    console.log("Rewarded video closed, is finished: ", event.isFinished)
)
Appodeal.addEventListener(AppodealRewardedEvent.FAILED_TO_LOAD, () =>
    console.log("Rewarded video failed to load")
)
Appodeal.addEventListener(AppodealRewardedEvent.FAILED_TO_SHOW, () =>
    console.log("Rewarded video failed to show")
)

Presentation

Note. All presentation specific methods are available only after SDK initialisation

  1. Caching

If you disable autocache you should call cache method before trying to show any ad

Appodeal.cache(AppodealAdType.INTERSTITIAL)
  1. Check that ad is loaded and can be shown
// Check that interstitial 
Appodeal.canShow(AppodealAdType.INTERSTITIAL, 'your_placement', (result) =>
    console.log("Interstitial ", result ? "can be shown" : "can not be shown")
)
// Check that banner is loaded 
Appodeal.isLoaded(AppodealAdType.BANNER, (result) =>
    console.log("Banner ", result ? "is loaded" : "is not loaded")
)
  1. Show advertising
// Show banner at the top of screen
Appodeal.show(AppodealAdType.BANNER_TOP)
// Show interstitial for specific pacement
Appodeal.show(AppodealAdType.INTERSTITIAL, 'your_placement')
  1. Hide

You can hide banner ad after it was shown. Call hide method with another ad types won't affect anything

Appodeal.hide(AppodealAdType.BANNER_TOP)

Consent Manager

Consent manager is used to provide GDPR and CCPA compliance. Consent manager SDK can be synchronized at any moment of application lifecycle. We recommend to synchronize it at application launch. Multiple synchronization calls are allowed.

Required parameter is appKey - Appodeal app key.

To synchronise user consent you can use following methods. If user consent is required it will shows fullscreen Consent Dialog. Callback will return information about latest user consent and current regulation zone.

Since the 2.7.0 version, Appdoeal SDK can be initialized directly with the Consent Report object of Consent Manager. If your application uses Consent Manager and you call the synchronize method before Appodeal initialization you don't need to pass boolean consent as an argument. SDK will check that the consent report exists and will use it.

In case Appodeal will try to initialize without boolean consent or before the Consent Manager is synchronized it will use false boolean consent.

import {
    Appodeal,
    AppodealConsentStatus,
    AppodealConsentRegulation,
} from 'react-native-appodeal';

Appodeal.synchroniseConsent('Your appKey', (consent: AppodealConsentStatus, regulation: AppodealConsentRegulation) => {
    // Initialise Appodeal SDK here
    Appodeal.initialize('Your appKey', adTypes);
})

You can force consent manager to show consent dialog at any moment of application lifecycle after consent manager was synchronised.

import {
    Appodeal,
    AppodealConsentStatus,
    AppodealConsentRegulation,
} from 'react-native-appodeal';

Appodeal.forceShowConsentDialog((consent: AppodealConsentStatus, regulation: AppodealConsentRegulation) => {
    // Handle updated data
})

You can get consent result for specific vendor bundle, that registered in Appodeal system. Eg you can use your application id.

import { Appodeal } from 'react-native-appodeal';

Appodeal.hasConsent('com.organisation.app', (consentResult: boolean) => {
    // Handle updated data
})

Note. Usage of Consent Manager is not required.

Banner View

AppodealBanner is a component that allows you to display ads in a banner format (know as AppodealBannerView).

Banners are available in 3 sizes:

  • phone (320x50)
  • tablet (728x90)
  • mrec (MREC)

Note if you want to show MREC banners in your app, you need to initialise Appodeal SDK with AppodealAdType. MREC

Appodeal Banner View can be used only after Appodeal SDK was initialized. You can show only one banner on the screen. Static banners (top or bottom) can't be used in one session with AppodealBanner.

import {
    AppodealBanner
} from 'react-native-appodeal';

<AppodealBanner
    style = {{
        height: 50,
        width: '100%',
        backgroundColor: 'hsl(0, 0%, 97%)',
        alignContent: 'stretch',
    }}
    adSize = 'phone'
    usesSmartSizing // (iOS specific) on Android smart banners are enabled by default.
/>

When banner is added on screen it starts to load ad automatically event if autocache is disabled.

Styling

Height property of banner styles should corresponds to adSize attribute. We recommend to use

adSize height
'phone' 50
'tablet' 90
'mrec' 250

Callbacks

Banner view has explicit callbacks.

<AppodealBanner
    style = {styles.banner}
    adSize = 'phone'
    usesSmartSizing // (iOS specific) on Android smart banners are enabled by default.
    onAdLoaded = {() => console.log("Banner view did load")}
    onAdExpired = {() => console.log("Banner view expired")}
    onAdClicked = {() => console.log("Banner view is clicked")}
    onAdFailedToLoad = {() => console.log("Banner view is failed to load")}
/>

Changelog

2.11.0

  • Update Appodeal to 2.11.0 (Stable)
  • Bump Android compileSdkVersion to 31.
  • Bump Android buildToolsVersion to 31.0.0
  • Remove methods:
Appodeal.disableLocationPermissionCheck();
Appodeal.disableWriteExternalStoragePermissionCheck();
Appodeal.requestAndroidMPermissions(params => {});

2.10.3

  • Update Appodeal to 2.10.3 (Stable)
  • Improvements of AppodealBanner behaviour

2.10.2

  • Update Appodeal to 2.10.2 (Stable)

2.10.1

  • Update Appodeal to 2.10.1 (Stable)

2.10.0-Beta

  • Update Appodeal to 2.10.0 (Beta)
  • [iOS] Fix disableNetwork method

2.9.1

  • Update Appodeal to 2.9.0 (Stable)

2.9.0

  • Update Appodeal to 2.9.0 (Beta)

2.8.2

  • Update Appodeal to 2.8.1 (Stable)

2.8.1-Beta

  • Update Appodeal to 2.8.1 (Beta)
  • [Android] Add method setSharedAdsInstanceAcrossActivities

2.7.7

  • [iOS] Fix setOnLoadedTriggerBoth method
  • [Android] Fix requestAndroidMPermissions method
  • Fix paramaters in AppodealRewardedEvent.CLOSED callback

2.7.6

  • [iOS] Update Appodeal to 2.7.5
  • [Android] Update Appodeal to 2.7.4

2.8.0-Beta

  • Update Appodeal to 2.8.0

2.7.5

  • [iOS] Add smart banners to banner view. Change pod dependency to Appodeal to 2.7.4

2.7.4

  • [iOS] Update Appodeal to 2.7.4
  • [Android] Fixes in banner view

2.7.3-Beta

  • Update Appodeal to 2.7.3-Beta

2.7.2-Beta

  • Update Appodeal to 2.7.2-Beta
  • Add deeper Consent Manager integration

2.6.5

  • Update Appodeal to 2.6.5
  • Fix iOS banner view

2.6.4

  • Update Appodeal to 2.6.4
  • Add banner view and MREC support
  • Add Consent Manager support

2.6.3

  • Update Appodeal to 2.6.3
  • Refactor plugin
  • Update dependency management

2.1.4

  • release
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].