Skip to content

Commit

Permalink
Pollfish Android IronSource Adapter v6.2.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fotism23 committed Apr 13, 2022
0 parents commit fa22e0f
Show file tree
Hide file tree
Showing 67 changed files with 2,133 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
*.apk
*.ap_
*.aab

*.dex

*.class

bin/
gen/
out/

.gradle/
build/

local.properties

proguard/

*.log

.navigation/

captures/

*.iml
.idea/workspace.xml
.idea/tasks.xml
.idea/gradle.xml
.idea/assetWizardSettings.xml
.idea/dictionaries
.idea/libraries

.idea/caches
.idea/modules.xml

.idea/navEditor.xml

.externalNativeBuild
.cxx/

freeline.py
freeline/
freeline_project_description.json

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/readme.md

vcs.xml

lint/intermediates/
lint/generated/
lint/outputs/
lint/tmp/

keys/
*.gpg

.DS_Store
/.idea/
250 changes: 250 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,250 @@
# Pollfish Android IronSource Mediation Adapter

IronSource Mediation Adapter for Android apps looking to load and show Rewarded Surveys from Pollfish in the same waterfall with other Rewarded Ads.

> **Note:** A detailed step by step guide is provided on how to integrate can be found [here](https://www.pollfish.com/docs/android-ironsource-adapter)
<br/>

## Step 1: Add Pollfish IronSource Adapter to your project

Download the following libraries

* [Pollfish SDK](https://www.pollfish.com/docs/android/google-play)
* [IronSource SDK](https://developers.is.com/ironsource-mobile/android/android-sdk/)
* [PollfishIronSourceAdapter](https://pollfish.com/docs/android-ironsource-adapter)

Import Pollfish IronSource adapter **.aar** file as it can be found in the **pollfish-ironsource-aar** folder, into your project libraries. Also import the **pollfish-googleplay-xxx.aar** which can be found [here](https://pollfish.com/docs/android/google-play)

If you are using Android Studio, right click on your project and select New Module. Then select Import .jar or .aar Package option and from the file browser locate Pollfish IronSource Adapter aar file. Right click again on your project and in the Module Dependencies tab choose to add Pollfish module that you recently added, as a dependency.

**OR**

#### **Retrieve Pollfish IronSource Adapter through mavenCentral()**

Retrieve Pollfish IronSource Adapter through **mavenCentral()** with gradle by adding the following line in your project **build.gradle** (not the top level one, the one under 'app') in dependencies section:

```groovy
dependencies {
implementation 'com.pollfish.mediation:pollfish-ironsource:6.2.4.0'
}
```

<br/>

## Step 2: Request for a RewardedAd

Import the following packages

<span style="text-decoration:underline">Kotlin</span>

```kotlin
import com.ironsource.mediationsdk.IronSource
import com.ironsource.mediationsdk.integration.IntegrationHelper
import com.ironsource.mediationsdk.logger.IronSourceError
import com.ironsource.mediationsdk.model.Placement
import com.ironsource.mediationsdk.sdk.RewardedVideoListener
```

<span style="text-decoration:underline">Java</span>

```java
import com.ironsource.mediationsdk.IronSource;
import com.ironsource.mediationsdk.integration.IntegrationHelper;
import com.ironsource.mediationsdk.logger.IronSourceError;
import com.ironsource.mediationsdk.model.Placement;
import com.ironsource.mediationsdk.sdk.RewardedVideoListener;
```

<br/>

Initialize IronSource SDK by calling the `init` method, passing the `Activity` and your App Key as provided by the IronSource dashboard. Do this as soon as possible after your app starts, for example in the `onCreate()` method of your launch Activity.

<span style="text-decoration:underline">Kotlin</span>

```kotlin
override fun onCreate(savedInstanceState: Bundle?) {
...

IntegrationHelper.validateIntegration(this)
IronSource.setRewardedVideoListener(this)
IronSource.init(this, "APP_KEY")
}
```

<span style="text-decoration:underline">Java</span>

```java
protected void onCreate(Bundle savedInstanceState) {
...

IntegrationHelper.validateIntegration(this);
IronSource.setRewardedVideoListener(this);
IronSource.init(this, "APP_KEY");
}
```

<br/>

Implement `RewardedVideoListener` so that you are notified when your ad is ready and of other ad-related events.

<span style="text-decoration:underline">Kotlin</span>

```kotlin
class MainActivity : AppCompatActivity(), RewardedVideoListener
```

<span style="text-decoration:underline">Java</span>

```java
class MainActivity extends AppCompatActivity implements RewardedVideoListener
```

<br/>

When the Rewarded Ad is ready, present the ad by invoking `IronSource.showRewardedVideo`. Just to be sure, you can combine show with a check to see if the Ad you are about to show is actualy ready.

<span style="text-decoration:underline">Kotlin</span>

```kotlin
if (IronSource.isRewardedVideoAvailable())
IronSource.showRewardedVideo()
```

<span style="text-decoration:underline">Java</span>

```java
if (IronSource.isRewardedVideoAvailable())
IronSource.showRewardedVideo();
```

<br/>

You can view a short example on how to intergate rewarded ads below

<span style="text-decoration:underline">Kotlin</span>

```kotlin
class MainActivity : AppCompatActivity(), RewardedVideoListener {

override fun onCreate(savedInstanceState: Bundle?) {
...

IntegrationHelper.validateIntegration(this)
IronSource.setRewardedVideoListener(this)
IronSource.init(this, "APP_KEY")
}

override fun onResume() {
...

IronSource.onResume(this)
}

override fun onPause() {
...

IronSource.onPause(this)
}

fun onShowRewardedAdClick(view: View) {
if (IronSource.isRewardedVideoAvailable())
IronSource.showRewardedVideo()
}

override fun onRewardedVideoAdOpened() {}

override fun onRewardedVideoAdClosed() {}

override fun onRewardedVideoAvailabilityChanged(available: Boolean) {}

override fun onRewardedVideoAdStarted() {}

override fun onRewardedVideoAdEnded() {}

override fun onRewardedVideoAdRewarded(placement: Placement) {}

override fun onRewardedVideoAdShowFailed(ironSourceError: IronSourceError?) {}

override fun onRewardedVideoAdClicked(placement: Placement) {}

}
```

<span style="text-decoration:underline">Java</span>

```java
class MainActivity extends AppCompatActivity implements RewardedVideoListener {

@Override
protected void onCreate(Bundle savedInstanceState) {
...

IntegrationHelper.validateIntegration(this);
IronSource.setRewardedVideoListener(this);
IronSource.init(this, "APP_KEY");
}

@Override
protected void onResume() {
...

IronSource.onResume(this);
}

@Override
protected void onPause() {
...

IronSource.onPause(this);
}

void onShowRewardedAdClick(View view) {
if (IronSource.isRewardedVideoAvailable())
IronSource.showRewardedVideo();
}

@Override
public void onRewardedVideoAdOpened() {}

@Override
public void onRewardedVideoAdClosed() {}

@Override
public void onRewardedVideoAvailabilityChanged(boolean available) {}

@Override
public void onRewardedVideoAdStarted() {}

@Override
public void onRewardedVideoAdEnded() {}

@Override
public void onRewardedVideoAdRewarded(Placement placement) {}

@Override
public void onRewardedVideoAdShowFailed(IronSourceError ironSourceError) {}

@Override
public void onRewardedVideoAdClicked(Placement placement) {}

}
```

<br/>

## Step 3: Publish

If you everything worked fine during the previous steps, you should turn Pollfish to release mode and publish your app.

> **Note:** After you take your app live, you should request your account to get verified through Pollfish Dashboard in the App Settings area.
> **Note:** There is an option to show **Standalone Demographic Questions** needed for Pollfish to target users with surveys even when no actually surveys are available. Those surveys do not deliver any revenue to the publisher (but they can increase fill rate) and therefore if you do not want to show such surveys in the Waterfall you should visit your **App Settings** are and disable that option.
# More info

You can read more info on how the Pollfish SDKs work or how to get started with IronSource at the following links:

[Pollfish iOS SDK](https://pollfish.com/docs/android/google-play)

[IronSource iOS SDK](https://developers.is.com/ironsource-mobile/android/android-sdk)
11 changes: 11 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.1.2' apply false
id 'com.android.library' version '7.1.2' apply false
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
id "io.codearte.nexus-staging" version "0.30.0"
}

task clean(type: Delete) {
delete rootProject.buildDir
}
1 change: 1 addition & 0 deletions example-java/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
35 changes: 35 additions & 0 deletions example-java/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
plugins {
id 'com.android.application'
}

android {
compileSdk 32

defaultConfig {
applicationId "com.pollfish.mediation.ironsource.example"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"
}

buildTypes {
release {
minifyEnabled false
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'

implementation 'com.ironsource.sdk:mediationsdk:7.2.1.1'
implementation project(':pollfish-ironsource')
}
23 changes: 23 additions & 0 deletions example-java/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ironsource.mediation.ironsource.example">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Androidironsourceadapter">
<activity
android:name="com.ironsource.mediation.ironsource.example.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
Loading

0 comments on commit fa22e0f

Please sign in to comment.