Skip to content

Commit

Permalink
release-adapter-ironsource-4.5.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
stasenkotsyandex committed Jan 21, 2022
1 parent ea22b65 commit 3b8861c
Show file tree
Hide file tree
Showing 29 changed files with 819 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ dependencies {
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.appcompat:appcompat:1.2.0'

implementation 'com.yandex.android:mobmetricalib:4.0.0'
implementation 'com.yandex.android:mobmetricalib:4.1.1'
implementation 'com.yandex.android:mobileads:4.5.0'
implementation 'com.yandex.ads.adapter:ironsource-mobileads:4.5.0.0'
implementation 'com.ironsource.sdk:mediationsdk:7.1.10'
implementation 'com.yandex.ads.adapter:ironsource-mobileads:4.5.0.2'
implementation 'com.ironsource.sdk:mediationsdk:7.1.14'
}
35 changes: 35 additions & 0 deletions Examples/IronsourceRewardedAdapterExample/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# built application files
*.apk
*.ap_

# files for the dex VM
*.dex

# Java class files
*.class

# generated files
bin/**
gen/**
out/**
gen-external-apklibs/**

# Local configuration file (sdk path, etc)
local.properties

# IntellijJ IDEA
*.iml
*.ipr
*.iws
.idea/**
classes/**
target/**

# Mac OS
.DS_Store

# Gradle
gradle-app.setting
.gradletasknamecache
.gradle/**
build/**
35 changes: 35 additions & 0 deletions Examples/IronsourceRewardedAdapterExample/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# built application files
*.apk
*.ap_

# files for the dex VM
*.dex

# Java class files
*.class

# generated files
bin/**
gen/**
out/**
gen-external-apklibs/**

# Local configuration file (sdk path, etc)
local.properties

# IntellijJ IDEA
*.iml
*.ipr
*.iws
.idea/**
classes/**
target/**

# Mac OS
.DS_Store

# Gradle
gradle-app.setting
.gradletasknamecache
.gradle/**
build/**
46 changes: 46 additions & 0 deletions Examples/IronsourceRewardedAdapterExample/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* This file is a part of the Yandex Advertising Network
*
* Version for Android (C) 2021 YANDEX
*
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at https://legal.yandex.com/partner_ch/
*/

apply plugin: 'com.android.application'

android {
compileSdkVersion 30
buildToolsVersion '30.0.2'

defaultConfig {
applicationId "com.yandex.ironsourceadapter.interstitial.sample"
minSdkVersion 19
targetSdkVersion 30
versionCode 1
versionName "1.0"
multiDexEnabled true
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.appcompat:appcompat:1.2.0'

implementation 'com.yandex.android:mobmetricalib:4.1.1'
implementation 'com.yandex.android:mobileads:4.5.0'
implementation 'com.yandex.ads.adapter:ironsource-mobileads:4.5.0.2'
implementation 'com.ironsource.sdk:mediationsdk:7.1.14'
}
17 changes: 17 additions & 0 deletions Examples/IronsourceRewardedAdapterExample/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/satsakul/ADT/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ This file is a part of the Yandex Advertising Network
~
~ Version for Android (C) 2018 YANDEX
~
~ You may not use this file except in compliance with the License.
~ You may obtain a copy of the License at https://legal.yandex.com/partner_ch/
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yandex.ironsourceadapter.rewarded.sample">

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

<application
android:name="com.yandex.ironsourceadapter.rewarded.sample.Application"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:theme="@style/AppTheme">
<activity
android:name="com.yandex.ironsourceadapter.rewarded.sample.MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

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

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* This file is a part of the Yandex Advertising Network
*
* Version for Android (C) 2021 YANDEX
*
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at https://legal.yandex.com/partner_ch/
*/
package com.yandex.ironsourceadapter.rewarded.sample;

import android.util.Log;

import androidx.multidex.MultiDexApplication;

import com.yandex.mobile.ads.common.InitializationListener;
import com.yandex.mobile.ads.common.MobileAds;

public class Application extends MultiDexApplication {

private static final String YANDEX_MOBILE_ADS_TAG = "YandexMobileAds";

@Override
public void onCreate() {
super.onCreate();

MobileAds.initialize(this, new InitializationListener() {
@Override
public void onInitializationCompleted() {
Log.d(YANDEX_MOBILE_ADS_TAG, "SDK initialized");
}
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
/*
* This file is a part of the Yandex Advertising Network
*
* Version for Android (C) 2021 YANDEX
*
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at https://legal.yandex.com/partner_ch/
*/
package com.yandex.ironsourceadapter.rewarded.sample;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

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;

public class MainActivity extends AppCompatActivity {

private static final String APP_KEY = "85460dcd";
private static final String TAG = "MainActivity";

private Button mLoadRewardedAdButton;
private Button mShowRewardedAdButton;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

mLoadRewardedAdButton = findViewById(R.id.load_rewarded_button);
mLoadRewardedAdButton.setOnClickListener(mLoadRewardedClickListener);

mShowRewardedAdButton = findViewById(R.id.show_rewarded_button);
mShowRewardedAdButton.setOnClickListener(mShowRewardedClickListener);
mShowRewardedAdButton.setEnabled(false);

IntegrationHelper.validateIntegration(this);

IronSource.init(this, APP_KEY, IronSource.AD_UNIT.INTERSTITIAL);
}

@Override
protected void onResume() {
super.onResume();
IronSource.onResume(this);
}

@Override
protected void onPause() {
super.onPause();
IronSource.onPause(this);
}

@Override
protected void onDestroy() {
IronSource.setInterstitialListener(null);
super.onDestroy();
}

private final View.OnClickListener mLoadRewardedClickListener = new View.OnClickListener() {
@Override
public void onClick(@NonNull final View v) {
mLoadRewardedAdButton.setEnabled(false);
mLoadRewardedAdButton.setText(getResources().getText(R.string.start_load_rewarded_button));

IronSource.setRewardedVideoListener(new IronSourceRewardedListener());
IronSource.loadRewardedVideo();
}
};

private final View.OnClickListener mShowRewardedClickListener = new View.OnClickListener() {
@Override
public void onClick(@NonNull final View v) {
if (IronSource.isInterstitialReady()) {
IronSource.showInterstitial();
}

mShowRewardedAdButton.setEnabled(false);
}
};

private class IronSourceRewardedListener implements RewardedVideoListener {

@Override
public void onRewardedVideoAdOpened() {
mShowRewardedAdButton.post(() -> {
mShowRewardedAdButton.setEnabled(true);
mLoadRewardedAdButton.setEnabled(true);
mLoadRewardedAdButton.setText(getResources().getText(R.string.load_rewarded_button));
});
}

@Override
public void onRewardedVideoAdClosed() {
Log.d(TAG, "onRewardedVideoAdClosed()");
}

@Override
public void onRewardedVideoAvailabilityChanged(boolean b) {
Log.d(TAG, "onRewardedVideoAvailabilityChanged()");
}

@Override
public void onRewardedVideoAdStarted() {
Log.d(TAG, "onRewardedVideoAdStarted()");
}

@Override
public void onRewardedVideoAdEnded() {
Log.d(TAG, "onRewardedVideoAdEnded()");
}

@Override
public void onRewardedVideoAdRewarded(Placement placement) {
Log.d(TAG, "onRewardedVideoAdRewarded()");
}

@Override
public void onRewardedVideoAdShowFailed(IronSourceError ironSourceError) {
final String errorMessage = String.format("onRewardedVideoAdShowFailed() code = %s, message = %s",
ironSourceError.getErrorCode(), ironSourceError.getErrorMessage());
Log.d(TAG, errorMessage);
mLoadRewardedAdButton.post(() -> {
mLoadRewardedAdButton.setEnabled(true);
mLoadRewardedAdButton.setText(getResources().getText(R.string.load_rewarded_button));
});
}

@Override
public void onRewardedVideoAdClicked(Placement placement) {
Log.d(TAG, "onRewardedVideoAdClicked()");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!--
~ This file is a part of the Yandex Advertising Network
~
~ Version for Android (C) 2018 YANDEX
~
~ You may not use this file except in compliance with the License.
~ You may obtain a copy of the License at https://legal.yandex.com/partner_ch/
-->

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity">

<Button
android:id="@+id/load_rewarded_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="@string/load_rewarded_button" />

<Button
android:id="@+id/show_rewarded_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/load_rewarded_button"
android:text="@string/load_rewarded_button" />

</RelativeLayout>
Loading

0 comments on commit 3b8861c

Please sign in to comment.