Hello Everyone,
Samsung Adhub is another way of monetizing your apps.
It features Banner ads and Interstitial ads.
Different from other ad networks is that with Samsung AdHub, you are able to set the interests of users to suit your app with a so called UserProfile.
This way you can display ads which are related to the user's age, gender, interests, etc.
The library is very easy to use and implement in your app!
A sample is delivered which explains everything in detail which i copied below.
Also don't forget to add the following to the manifest file!
However I haven't been able to display an interstitial ad yet. Perhaps you need an Active InventoryID to test Interstitial ads out instead of a development one because i'm sure my code is correct.
As last!
Don't forget to register to Samsung AdHub when releasing your application.
You'll need to fill in some regular stuff, create your appform and retrieve your inventory id.
Don't forget to change your test inventoryID with your actual one!
http://www.samsungadhub.com/main.do
In the attachments, you can find:
- Documentation: (Javadoc, Readme)
- Sample file
- Library files
Have fun!
Tomas
Samsung Adhub is another way of monetizing your apps.
It features Banner ads and Interstitial ads.
Different from other ad networks is that with Samsung AdHub, you are able to set the interests of users to suit your app with a so called UserProfile.
This way you can display ads which are related to the user's age, gender, interests, etc.
The library is very easy to use and implement in your app!
A sample is delivered which explains everything in detail which i copied below.
B4X:
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
'Declaration of the ads.
Dim adBanner As AdHubBanner
Dim adSize As AdHubSize
Dim adInterstitial As AdHubInterstitial
Dim adProfile As AdHubUserProfile
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Loads the Activity stuff
Activity.loadlayout("Main.bal")
Activity.AddMenuItem("Show Ad Banner","mnuBanner")
Activity.AddMenuItem("Show Ad Interstitial","mnuInterstitial")
'Initializes the AdHub Banner.
'1th Param: EventName
'2nd Param: Id from Samsung Adhub - The current one is for development stage!
'3th Param: Banner Size
'4th Param: Set Listener?
adBanner.Initialize("Banner", "2011000001_001", adSize.Banner, True)
'Initializes the AdHub Interstitial.
'1th Param: EventName
'2nd Param: Id from Samsung Adhub - The current one is for development stage!
'3th Param: Set Listener?
adInterstitial.Initialize("Interstitial", "2011000001_001", False)
'Initialize AdHub Profile
'This is used to determine who the adviewer is: intrests, age, gender, etc.
adProfile.Initialize
adProfile.Age = 18
adProfile.Gender = "m"
adProfile.Interests = "Programming"
adProfile.Interests = "Basic4Android"
adProfile.Interests = "Samsung Galaxy"
'Then you can attach it to one of the ads.
adBanner.UserProfile = adProfile.UserProfile
'Sets a listener - --- Only do this when the last parameter in the Initialize method is false! ---
'adBanner.setAdListener '- Not needed because we set it to true in initialize.
'Doesn't count for Interstitial because it is false in initialize.
adInterstitial.setAdListener
'Add the AdHub Banner to the Activity
Activity.AddView(adBanner, 0dip, 0dip, 320dip, 48dip)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
'Shows an AdHub ad banner when clicked.
Sub mnuBanner_Click
'Starts an AdHub banner.
adBanner.startAd
End Sub
'Show an AdHub Interstitial ad when clicked
Sub mnuInterstitial_Click
'Shows an AdHub Interstitial ad.
adInterstitial.startAd
End Sub
' ---- !Adhub Banner Ads Events! ---- '
Sub Banner_OnAdFailed (Message As String)
Log("Error AdHub Banner: " & Message)
End Sub
Sub Banner_OnAdReceived
Log("AdHub Banner received!")
End Sub
' ---- !Adhub Interstitial Ads Events! ---- '
Sub Interstitial_OnAdFailed (Message As String)
Log("Error: " & Message)
End Sub
Sub Interstitial_OnAdReceived
Log("AdHub Interstitial Ad received!")
End Sub
Sub Interstitial_onAdInterstitialClosed
Log("Adhub Interstitial Ad Closed.")
End Sub
Also don't forget to add the following to the manifest file!
B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="4" />
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.
'Banner ads - AdHub
SetApplicationAttribute(android:configChanges, "keyboardHidden|orientation")
'Interstitial ads - AdHub
AddApplicationText(
<activity
android:name="com.sec.android.ad.AdActivity"
android:configChanges="keyboardHidden|orientation" /> )
However I haven't been able to display an interstitial ad yet. Perhaps you need an Active InventoryID to test Interstitial ads out instead of a development one because i'm sure my code is correct.
As last!
Don't forget to register to Samsung AdHub when releasing your application.
You'll need to fill in some regular stuff, create your appform and retrieve your inventory id.
Don't forget to change your test inventoryID with your actual one!
http://www.samsungadhub.com/main.do
In the attachments, you can find:
- Documentation: (Javadoc, Readme)
- Sample file
- Library files
Have fun!
Tomas
Attachments
Last edited: