Ads in armory 3d on android

Does anyone know how to get admod ads in armory 3d for android. I first thought of enhance.co but it doesn’t seeam to be uptodate. I got the libraries for admod with kha but don’t know how to emplement them…

Hi,

Could you share the resource where you found how to use admod with Kha?

So I found a very promising way to adding admod in armory because i read thought the instructions and know how to implement everything BUT the is one thing I don’t fully understand yet. https://github.com/laxa88/wyn-kha-lib/tree/master/wyn_admob

So when it says to integrate the ‘wyn_admob’ and ‘wyn_common’ folder to your Libraries folder…
Is it referring to the Armory SDK folder or the folder created with every project?

The Libraries folder should be a subfolder of your project folder. As I already wrote on Discord, Armory should pick it up automatically so you usually don’t need to append the project.addLibrary() calls to the khafile anymore as Armory will do this for you when exporting the game.

1 Like

Okay, well could you act like I’m dumb (not much acting needed actually :rofl:)
So to import the 2 folders needed I much first export the file? or just build it?
Then armory will create the folders automatically. So where would I past the 2 folder in then because I don’t see a folder labeled libraries in the armory sub folder… :disappointed_relieved:

You need to create it yourself, then Armory will recognize it and add the “references” to it in the Khafile. Sorry, I skipped that step in my explanation above :sweat_smile: Make sure to really call it Libraries (I think it’s case sensitive).

More information: https://github.com/Kode/Kha/wiki/Libraries and https://github.com/Kode/Kha/wiki/khafile.js#add-a-library-to-the-project

1 Like

Okay, I think I got it but Now I think I need to make a haxe script in the scene trait and past the code from the USAGE section into it… but yet again, I’m dum dum so I spit out million errors. Any insight?
I’m trying to just implemant a banner because much easier… So i tried to copy/past the banner code but got errors and the top paragraph seamed to define the code and that also give me errors… :sob:

Without seeing the errors it is difficult to help, but I guess that something isn’t defined?

You have to define all the callback functions (like adViewDidReceiveAd etc.) yourself, because their functionality depends on what your app does. For example, should there be a reward for watching ads, should there be an error displayed when no ad could be loaded etc… The library calls those callbacks when certain events occur (thus the name “callback”) so you can decide what should happen then (can be nothing). So you should probably start learning what functions are and how they are defined in Haxe.

I don’t know for what the callbacks are used in detail, but this should be documented somewhere (probably there is an admob API documentation?). Maybe they can even be null, I don’t know.

Btw: the Haxe quirks described in the top comment of the usage example probably don’t exist anymore – the repository (admob part) wasn’t updated since March 2016 and Haxe received a lot of updates since then. You you should be able to pass the callback functions directly.

Edit: you can find the function signatures of the callbacks here: https://github.com/laxa88/wyn-kha-lib/blob/master/wyn_admob/Sources/wyn/WynAdmob.hx#L47-L50 (first and last highlighted line)

1 Like

Ok… aaaarrhhhh, Is the anyone you think might be able to help me with this… I mean like a developer how can implement it and document how to do the same with a YouTube video or a web post… or literally anything cause I’m dying over here. It is impossible to learn a hole new scripting language for me… I’m not exactly the coding sort of guy…and this is way to overwhelming for me :pray:t2:

I won’t explain you how Haxe works (that takes way too much time), but because I think that you probably don’t really need to use the callbacks that much I will explain functions in very little detail:

A function is basically a block of code that can be called from different places. A/the main purpose of functions is to bundle common functionality together and to be able to call it multiple times.

A function gets some input values which it can access (commonly called “parameters” or “arguments” *) and has an output value (called the “return value”). It’s like in maths were you can have f(x) = y. x is a parameter and y the return value (Warning! This is not mathematically correct but it helps to explain it).

* There actually can be a difference between arguments and parameters but it won’t matter here, both terms are more or less interchangeable.

A simple function would be defined like this in Haxe:

//       Functions have names
//       |              This function has two Int inputs and a Bool type output
//       v              v               v                  v
function myFunctionName(argument1: Int, argument2: Int) -> Bool {
	// Everything between the {} is called the "function body",
	// here you can state what should happen if the function gets called.

	// Because we defined that the function returns a boolean, we need
	// to return a value, in this case `true`. 
	return true;
}

Many functions don’t need to have inputs or outputs, which is denoted by the Haxe type Void:

function myFunctionName() -> Void {
	// No inputs (empty ()) and no return value (Void)

	// So actually, this function can be empty but we also could
	// do something in here but just not return anything.
}

In your case:

In the file I linked above, you can see that the functions are described like such for example:
adViewDidReceiveAd: Void->Void or didFailToReceiveAdWithError: String->Void.

Everything behind the : is a type (like Void or String), the type after the last -> is the return type, everything else before are the argument types.

So didFailToReceiveAdWithError: String->Void is a function with a String input and no return value.
adViewDidReceiveAd: Void->Void is a function without parameters and no return value. The first function in this answer would be denoted as myFunctionName: Int->Int->Bool.

Again, this is not precise in any way, it’s just to hopefully make it possible that you can get things working. I tried to use as few technical terms as possible, but I can totally understand that it’s still complicated and I still didn’t describe how functions are called and how you pass them and so on… But this is all done in the example code in the repository.

3 Likes

Wow, thanks, wasn’t waiting for a hole explanation but thanks :blush:
It is much more clear now :+1:t2: Ok I will go try figure out this code now… Should work much better knowing what I’m doing… well at least a minimum anyway

2 Likes