Android Question Google Doubleclick Ads

tufanv

Expert
Licensed User
Longtime User
Hello,

I am displayin about 30.000 impression per day with my apps and the cpm with admob is too low. Other mediation options like facebook are worse than the admob. So I decided to use Google Doubleclik for Publishers where you can sell your inventory to advertisers.

Doubleclick also uses google ads sdk but I think there are some differences .
https://developers.google.com/mobile-ads-sdk/docs/dfp/android/quick-start

I think it is not possible to use with the current firebase admob lib . Doubleclick is a great opportunity to increase ad revenue so is it possible to somehow display doubleclick ads ? As it is using the same lib it must not be so hard , but i think there must be some features added to current android or ios lib ?
,
Thanks
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Start with this code:
B4X:
Sub CreatePublisherAd As View
   Dim ctxt As JavaObject
   ctxt.InitializeContext
   Dim padview As JavaObject
   padview.InitializeNewInstance("com.google.android.gms.ads.doubleclick.PublisherAdView", Array(ctxt))
   Dim adv As AdView 'ignore
   Dim sizes As JavaObject
   sizes.InitializeArray("com.google.android.gms.ads.AdSize", Array(adv.SIZE_BANNER))
   padview.RunMethod("setAdSizes", Array(sizes))
   padview.RunMethod("setAdUnitId", Array("ad unit here"))
   Dim builder As JavaObject
   builder.InitializeNewInstance("com.google.android.gms.ads.doubleclick.PublisherAdRequest$Builder", Null)
   builder.RunMethod("addTestDevice", Array("0C7E7C3E315C7706E63185ABF6BF8AAF")) 'change based on the unfiltered logs message
   padview.RunMethod("loadAd", Array(builder.RunMethod("build", Null)))
   Return padview
End Sub
 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
You are the best ! thanks Erel,
When you have free time, can you give an example for b4i also ? I will open another topic for that in b4i forum.

Regards
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
what is the difference between regular admob ads and doubleclick ads, Tufanv?
 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
what is the difference between regular admob ads and doubleclick ads, Tufanv?
I have started to check this some days ago. As I did not try yet because it was not possible without the code I am not %100 sure but with doublelick you can sell your ad spaces to advertisers. I have started to read the documents in Publisher University of Google.

My concern is , We have to change the ad unit of regular admob to doubleclick and what if doubleclick is not able to fill the inventory ? Will it be backed up by admob or not ? I am not sure. I will start to test after I complete the reading and write here.

according to what people says :
You get it from whoever contracted you to display the ads. DFP is an ad management service. It doesn't have anything to do with payments or getting ads. The only exception is if you run backfill with Adsense in which case you get paid as per normal of the Adsense payout schedule.

I think we are making agreement for number of impressions for x dollars and sell it through doubleclick. I will write back as I complete the tutorial and try the code.
 
Last edited:
Upvote 0

sorex

Expert
Licensed User
Longtime User
My concern is , We have to change the ad unit of regular admob to doubleclick and what if doubleclick is not able to fill the inventory ? Will it be backed up by admob or not ?

I doubt it, as it is not init-ed with the admob key.

my concern would be that they verify your app installs and all that first and if you don't have many they'll skip you.
 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
Start with this code:
B4X:
Sub CreatePublisherAd As View
   Dim ctxt As JavaObject
   ctxt.InitializeContext
   Dim padview As JavaObject
   padview.InitializeNewInstance("com.google.android.gms.ads.doubleclick.PublisherAdView", Array(ctxt))
   Dim adv As AdView 'ignore
   Dim sizes As JavaObject
   sizes.InitializeArray("com.google.android.gms.ads.AdSize", Array(adv.SIZE_BANNER))
   padview.RunMethod("setAdSizes", Array(sizes))
   padview.RunMethod("setAdUnitId", Array("ad unit here"))
   Dim builder As JavaObject
   builder.InitializeNewInstance("com.google.android.gms.ads.doubleclick.PublisherAdRequest$Builder", Null)
   builder.RunMethod("addTestDevice", Array("0C7E7C3E315C7706E63185ABF6BF8AAF")) 'change based on the unfiltered logs message
   padview.RunMethod("loadAd", Array(builder.RunMethod("build", Null)))
   Return padview
End Sub
Can this still work ?
 
Upvote 0
Top