Skip to content

noctisalamandra/godot-yandex-ads-android

Repository files navigation

Godot YandexAdsAndroid

This plugin is designed to connect Yandex advertising to godot.

Instruction

1. Downloading

Download and unpack this archive.

Download

2. Distribution by files

Adding a folder to the root section of the project.

Project

3. Project Setup

In the project settings, enable the plugin.

Settings

When exporting a project, enable "Use Grade Build".

Plugin

In the "Permissions" section, enable "Access Network State" and "Internet".

Then create a node for the advertising module where you need it and connect the "yandex_ads.gd" script, which can be found in the folder that we added.

Node

And insert the ID of your ad.

Key

In build.gradle along the way "android/build/build.gradle" add the following code:

dependencies {
    ...
    implementation "com.yandex.android:mobileads:7.1.0"
}
android {

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

Then you can use the signals and functions written in the script to display ads.

Signals

func _ready():
	$YandexAds.load_banner() 

func _on_rewarded_pressed():
	$YandexAds.load_rewarded_video()

func _on_interstitial_pressed():
	$YandexAds.load_interstitial()

func _on_yandex_ads_rewarded_video_loaded():
	$YandexAds.show_rewarded_video() 

func _on_yandex_ads_interstitial_loaded():
	$YandexAds.show_interstitial() 

func _on_yandex_ads_banner_loaded():
	$YandexAds.show_banner() 

func _on_yandex_ads_rewarded(currency, amount):
	pass

An example of plug-in connection can be found here.