npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@redpill-paris/react-native-ironsource

v2.0.0

Published

SDK api in react native for IronSource

Downloads

5

Readme

react-native-ironsource

react-native-ironsource is a bridge to use ironsource android and ios SDK .

Part of SDK implemented:

  • Initialisation.
  • Rewarded video.

Install

  yarn add @redpill-paris/react-native-ironsource

Configuration

Android

Add the following to your android/build.gradle file inside repositories section:

  maven {
    url "https://dl.bintray.com/ironsource-mobile/android-sdk"
  }

Then add the following to the dependencies section of your android/ap/build.gradle:

  dependencies {
      implementation 'com.ironsource.sdk:mediationsdk:6.16.2' 
  }

Add the following permissions to your AndroidManifest.xml file inside the manifest tag but outside the tag:

  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Add the following activities inside the tag in your AndroidManifest:

  <activity
    android:name="com.ironsource.sdk.controller.ControllerActivity"
    android:configChanges="orientation|screenSize"
    android:hardwareAccelerated="true"
  />
  <activity
    android:name="com.ironsource.sdk.controller.InterstitialActivity"
    android:configChanges="orientation|screenSize"
    android:hardwareAccelerated="true"
    android:theme="@android:style/Theme.Translucent"
  />
  <activity
    android:name="com.ironsource.sdk.controller.OpenUrlActivity"
    android:configChanges="orientation|screenSize"
    android:hardwareAccelerated="true"
    android:theme="@android:style/Theme.Translucent"
  />

Add the Play Services dependencies into the dependencies block:

  dependencies {
      implementation fileTree(dir: 'libs', include: ['*.jar'])
      implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0'
      implementation 'com.google.android.gms:play-services-basement:17.1.1'
  }

You need to add the Network Adapters you want in the podfil of your app.

Exemple:

    implementation 'com.ironsource.adapters:vungleadapter:4.3.0@jar'
    implementation 'com.vungle:publisher-sdk-android:6.5.3'

    implementation 'com.ironsource.adapters:adcolonyadapter:4.3.0@jar'
    implementation 'com.adcolony:sdk:4.1.4'

    implementation 'com.ironsource.adapters:facebookadapter:4.3.14@jar'
    implementation 'com.facebook.android:audience-network-sdk:5.9.0'

Look at the official documentation for more information: https://developers.ironsrc.com/ironsource-mobile/android/mediation-networks-android/

IOS

You need to add the Network Adapters you want in the podfil of your app.

Exemple:

  pod 'IronSourceAppLovinAdapter','> 1'
  pod 'IronSourceVungleAdapter','> 1'
  pod 'IronSourceFacebookAdapter','> 1'
  pod 'IronSourceAdColonyAdapter','> 1'

Look at the official documentation for more information: https://developers.ironsrc.com/ironsource-mobile/ios/mediation-networks-ios/

Methods:

  • Initialisation:

initIronsourceSDK:

  await Ironsource.initIronsourceSDK('a392e26d', 'demoapp', { activateIntegrationHelper: true });

setConsent:

  IronSource.setConsent(true);
  • Rewarded Video:

initializeRewardedVideo

  Ironsource.initializeRewardedVideo();

isRewardedVideoAvailable:

  await Ironsource.isRewardedVideoAvailable();

isRewardedVideoAvailable:

  await Ironsource.isRewardedVideoAvailable();

showRewardedVideo:

  Ironsource.showRewardedVideo('DefaultRewardedVideo');

Listeners

Listeners available:

  • 'ironSourceRewardedVideoAvailable'
  • 'ironSourceRewardedVideoUnavailable'
  • 'ironSourceRewardedVideoDidOpen'
  • 'ironSourceRewardedVideoDidStart'
  • 'ironSourceRewardedVideoClosedByUser'
  • 'ironSourceRewardedVideoClosedByError'
  • 'ironSourceRewardedVideoAdStarted'
  • 'ironSourceRewardedVideoAdEnded'
  • 'ironSourceRewardedVideoAdRewarded'

addEventListener:

    function listenerRewardVideo(resolve, reject) {
      Ironsource.addEventListener('ironSourceRewardedVideoAdRewarded', res => {
        console.log(`Rewarded! ${JSON.stringify(res)}`, 'log');
        resolve();
      });
    }

Exemple:

export default function App() {

  function listenerRewardVideo(resolve, reject) {
    console.log('Setup Listeners reward Video', 'log');
    Ironsource.addEventListener('ironSourceRewardedVideoAdRewarded', res => {
      console.log(`Rewarded! ${JSON.stringify(res)}`, 'log');
      resolve();
    });
    Ironsource.addEventListener('ironSourceRewardedVideoClosedByUser', () => {
      console.log(`Video reward closed by the User`, 'warn');
      Ironsource.removeAllListeners();
      resolve();
    });
    Ironsource.addEventListener('ironSourceRewardedVideoClosedByError', () => {
      console.log(`Video reward closed by an Error`, 'error');
      Ironsource.removeAllListeners();
      reject(new Error('Video closed by an error'));
    });
    console.log('Success Setup Listeners reward Video', 'log');
  }

  return (
    <View style={styles.container}>
      <Button title={'Init'} onPress={async () => {
        console.log('Ironsource from app:', Ironsource);
        await Ironsource.initIronsourceSDK(Platform === 'ios'  ? 'a8de03dd' : 'a392e26d', 'demoapp', { activateIntegrationHelper: true });
      }}/>
      <Button title={'init rewarded'} onPress={() => {
        console.log('init rewarded');
        Ironsource.initializeRewardedVideo();
      }}/>
      <Button title={'call is rewarded'} onPress={async () => {
        console.log('Ironsource is rewarded video available called');
        console.log('Ironsource is rewarded video available ?', await Ironsource.isRewardedVideoAvailable());
      }}/>
      <Button title={'Show'} onPress={() => {
        return new Promise(async (resolve, reject) => {
          listenerRewardVideo(resolve, reject);
          console.log('Ironsource showrewarded video');
          Ironsource.showRewardedVideo('DefaultRewardedVideo');
        });
      }}/>
    </View>
  );
}

Don't forget to take a look at the AppExampleIronsource for more information !