Tutorial 1-how to show banner ad at top of applicationadmin To Published in 2015-06-25 android( Read:2996

how to show banner ad at top of application

package com.keymob.demo;

import android.app.Activity;
import android.os.Bundle;

import com.keymob.networks.AdManager;
import com.keymob.networks.core.BannerPositions;
import com.keymob.networks.core.BannerSizeType;

public class BannerActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
AdManager.getInstance().initFromKeymobService(this, "1", null, true);
AdManager.getInstance().showRelationBanner(BannerSizeType.BANNER,
BannerPositions.TOP_CENTER, 0);
}
}
1.Not familiar with the android programming developers to learn the basics, just to explain the keymob releated code here.

2.add class impliments
import com.keymob.networks.AdManager;
import com.keymob.networks.core.BannerPositions;
import com.keymob.networks.core.BannerSizeType;
3.init admanager in onCreate,this is the context to show ad,"1" is app id,we do not handle ad event so we pass null for third parameter,we will publish this app now,so pass true for the last parameter.

AdManager.getInstance().initFromKeymobService(this, "1", null, true);
4.show Banner ,banner size is BannerSizeType.BANNER and ad position is at top center of application .margin 0 px;

AdManager.getInstance().showRelationBanner(BannerSizeType.BANNER,
BannerPositions.TOP_CENTER, 0);

0 Reviews,0 Participation.

Next 0

Latest comments

No comment Oh!