Hi, anybody have used Samsung AdHub? I have a problem, when the Ad is on screen sometime the Ad clear the scene in my activity…
Any idea? AdMob or chartboost, works fine!
Thanks!
Stefano
2013-11-22 17.38.26.jpg (271.1 KB)
Hi, anybody have used Samsung AdHub? I have a problem, when the Ad is on screen sometime the Ad clear the scene in my activity…
Any idea? AdMob or chartboost, works fine!
Thanks!
Stefano
2013-11-22 17.38.26.jpg (271.1 KB)
I have AdHub banner and video ads working, never got round to releasing or testing it fully but here is my code if it helps, I think it works fine:-
OnCreate setup:
banner ads
AdHubView adhubView;
adhubView = new AdHubView(this);
adhubView.init( this, "your inventory id", AdSize.BANNER);
adhubView.setRefreshRate(15*1000);
adhubView.setListener(new AdNotificationListener() {
public void onAdReceived(AdHubView arg0)
{
// TODO Auto-generated method stub
// Toast.makeText(ArrowMania.this, "onAdReceived", Toast.LENGTH_SHORT).show();
// Log.d(TAG, "onAdReceived called");
}
public void onAdFailed(AdHubView arg0, Exception arg1)
{
// TODO Auto-generated method stub
//Toast.makeText(ArrowMania.this, "onAdFailed: "+arg1.toString() , Toast.LENGTH_SHORT).show();
//Log.d(TAG, "onAdFailed called: " + arg1.toString());
}
});
adhubView.startAd();
LinearLayout.LayoutParams llParams = new LinearLayout.LayoutParams(
getWindowManager().getDefaultDisplay().getWidth(), -50);
LinearLayout subLayout = new LinearLayout(this);
subLayout.setOrientation(LinearLayout.VERTICAL);
subLayout.setBackgroundColor(Color.TRANSPARENT);
subLayout.setGravity(Gravity.CENTER);
addContentView(subLayout, llParams);
adViewContainer = subLayout;
adViewContainer.addView(adhubView);
In OnCreate too: Video ads
video = new AdHubVideoPlayer(this, "your inventory id");
video.setListener(new AdVideoListener() {
@Override
public void onAdVideoReceived() {
// TODO Auto-generated method stub
Log.d(TAG, "onAdVideoReceived()");
Toast.makeText(ArrowMania.this, "onAdVideoReceived()", Toast.LENGTH_SHORT).show();
m_iSamsungVideoState = CB_INSERTIAL_TRYING_TO_SHOW;
}
@Override
public void onAdVideoFailed(Exception e) {
// TODO Auto-generated method stub
Log.d(TAG, "onAdVideoFailed()");
Toast.makeText(ArrowMania.this, "onAdVideoFailed() : " + e.toString(), Toast.LENGTH_SHORT).show();
m_iSamsungVideoState = CB_INSERTIAL_SHOW_FAILED;
}
@Override
public void onAdVideoRefusedByUser() {
// TODO Auto-generated method stub
Log.d(TAG, "onAdVideoRefusedByUser()");
Toast.makeText(ArrowMania.this, "onAdVideoRefusedByUser()", Toast.LENGTH_SHORT).show();
m_iSamsungVideoState = CB_INSERTIAL_SHOW_FAILED;
}
@Override
public void onVideoClosed() {
// TODO Auto-generated method stub
Log.d(TAG, "onVideoClosed()");
Toast.makeText(ArrowMania.this, "onVideoClosed()", Toast.LENGTH_SHORT).show();
m_iSamsungVideoState = CB_INSERTIAL_CLOSED;
}
@Override
public void onContentVideoReceived() {
// TODO Auto-generated method stub
Log.d(TAG, "onContentVideoReceived()");
Toast.makeText(ArrowMania.this, "onContentVideoReceived()", Toast.LENGTH_SHORT).show();
m_iSamsungVideoState = CB_INSERTIAL_TRYING_TO_SHOW;
}
@Override
public void onContentVideoFailed(Exception e) {
// TODO Auto-generated method stub
Log.d(TAG, "onContentVideoFailed()");
Toast.makeText(ArrowMania.this, "onContentVideoFailed() : " + e.toString(), Toast.LENGTH_SHORT).show();
m_iSamsungVideoState = CB_INSERTIAL_SHOW_FAILED;
}
To show a video ad just call “video.startAdAppLaunchRoll();”
Thanks! Now I try it!
For adhub as landscape? (for fill the screen width)
Thanks!
Stefano Campodall’Orto wrote:
For adhub as landscape? (for fill the screen width)
I can’t say for sure, change the “.BANNER” setting in “adhubView.init( this,”your inventory id“, AdSize.BANNER);” and look at the Samsung docs. Also look at the “LayoutParams”. You’ll see I have a banner size top middle of the screen in landscape in that code.