v67+ ad choices and initialisation

Monkey Forums/Monkey Programming/v67+ ad choices and initialisation

pantson(Posted 2013) [#1]
Hi
Just been looking at the new Ad modules... my previous attempts at admob, leadbolt have been succesfull. I initialise them in a different way though and prefer my way.
For Admob.. my Monkey code
import admob

function Main()
  AdInit(ID)
  AdBottom()
  AdShow()

  New game()
end


for Leadbolt, I use the same functions but import leadbolt instead
import leadbolt

function Main()
  AdInit(ID)
  AdBottom()
  AdShow()

  New game()
end


Is it possible to make the function more generic so we can add publishers to the official monkey ad module? Also can we call the ID in the code please?
I'm not sure this is the correct way of doing it and comments are certainly welcome

Also can we add a method to call different size banners please?
BANNER on 7inch+ tablets is very small. Standard larger screens really need IAB_BANNER initialising.
Again in may java code, I detect the width of the screen (and density) to call either BANNER or IAB_BANNER
crude code ;-)
		// get display stuff
		Display display = activity.getWindowManager().getDefaultDisplay();

		// metrics
		DisplayMetrics metrics = new DisplayMetrics();
		display.getMetrics(metrics);

		// set vertical or horizontal
		if (display.getWidth()<display.getHeight()) {
			// portrait
			if (display.getWidth()<(320*metrics.density + 1)) {
				adView = new AdView(activity, AdSize.BANNER, MY_AD_UNIT_ID);
			} else {
				adView = new AdView(activity, AdSize.IAB_BANNER, MY_AD_UNIT_ID);
			}
		} else {
			// landscape
			if (display.getWidth()<(800*metrics.density)+1) {
				adView = new AdView(activity, AdSize.BANNER , MY_AD_UNIT_ID);
			} else {
				adView = new AdView(activity, AdSize.IAB_BANNER, MY_AD_UNIT_ID);
			}
		}


Chartboost is different as it doesn't display banners, but again I call the IDs from my code and not the config files.

Maybe Marks way is more flexible...


sionco(Posted 2013) [#2]
Hi.
I didn't realize leadbolt could be imported, a lot better than admob
I have an account with them from when I was using basic4android.

Sorry to hijack your thread, but to use leadbolt, Do I just have to put the leadbolt sdk somewhere using monkey v67e and then use the code?:

 
import leadbolt

function Main()
  AdInit(ID)
  AdBottom()
  AdShow()

  New game()
end


or does it somehow work with your admob module you made a while ago? (which works well) any help appreciated


pantson(Posted 2013) [#3]
I rewrote my admob module to cover the above for leadbolt to make it more universal for multiple ad providers.
So no, dropping in Leadbolt for v67e or my published admob module wont work

I'll dig out the code later on.. Off travelling with work soon, so wont be around my dev environment for a couple of days

If I remember rightly, leadbolt controls the position of the ad using their interface (not in the code). but I got round this by creating a webview and displaying an html banner from leadbolt. I could then control the position of the window in the code.

Forgot to mention: all my code is for Android only, I have never got this working as a module for iOS as I havent need to yet


sionco(Posted 2013) [#4]
Thanks. I look forward to it.


Xaron(Posted 2013) [#5]
What is leadbolt and why is it better than Admob?


pantson(Posted 2013) [#6]
leadbolt is another ad providor (like chartboost, revmob, mochiads)
Not sure why its better though.


sionco(Posted 2013) [#7]
I've had experience with leadbolt and admob, and always got a lot better financial return from leadbolt.


MikeHart(Posted 2013) [#8]
Maybe Leadbolt is supported through Admobs mediation functionality.