Android Question AppBrains AdId

Feten7

Member
Licensed User
Hi:

I've managed to include a banner with Appbrains thanks to Erel and amidgeha. Now, i'd like to show some banners in several activities so i've created some of them in Appbrains web. The problem comes when i want to identify the banner i'm showing. I've searched in appbrains documentation and there is a function to set the Id of the ad to show:
public void setAdId(AdId id)
But i don't know how to implement this in B4A. Any help?
 

DonManfred

Expert
Licensed User
Longtime User
https://www.appbrain.com/info/help/sdk/javadoc/AdId.html#com.appbrain.AdId

'Possible values: DEFAULT, HOME_SCREEN, STARTUP, PAUSE, EXIT, LEVEL_START, LEVEL_COMPLETE, ACHIEVEMENTS, LEADERBOARDS, STORE
Sub CreateAd (AdUnitId As String) As JavaObject
Dim AdId As JavaObject
AdId.InitializeStatic("com.appbrain.AdId")
Dim builder As JavaObject
builder = builder.InitializeStatic("com.appbrain.InterstitialBuilder").RunMethod("create", Null)
builder.RunMethod(
"setAdId", Array(AdId.GetField(AdUnitId)))
Dim listener As Object = builder.CreateEventFromUI("com.appbrain.InterstitialListener", "listener", Null)
builder.RunMethod(
"setListener", Array(listener))
builder.RunMethod(
"preload", Array(ctxt))
Return builder
End Sub
 
Upvote 0

Feten7

Member
Licensed User
Thanks for your answer but I'm not sure if in banner ads it would work like this because the possible values aren't suitable to them. I think I should change the AdId property with something like
AdId.SetField("AdId", and this is an object I don't know what to do with it)
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
public void setAdId(AdId id)
click on the AdId link. it brings you to a page with all possibilities. All of them are useable with the method i referenced i guess (don´t use any Ads).
Just use HOME_SCREEN or any of the other values when calling the Method CreateAd.
B4X:
CreateAd("HOME_SCREEN")
 
Upvote 0

Feten7

Member
Licensed User
Thanks DonManfred. I've spent these days waiting for the Appbrain dashboard to show the impressions but 0 is still on it. I've named them the way you told me following Erel's tutorial but there's no result by the moment.
 
Upvote 0

Feten7

Member
Licensed User
Now it's working. For those who might want to do this: No matter how you name them in Appbrains' web they will appear the way you've named them in b4a. Quite strange but it works. This is not like in Admob, you can't do anything with the AdId.
Thanks DonManfred for helping
 
Upvote 0
Top