-
Notifications
You must be signed in to change notification settings - Fork 1
###Integrating the adds
Once is configured this module with your parameters, you can choose between 2 options:
- Available Advertisements in Malcom.
You'll need to include the following in your desired activity layout.
<LinearLayout
android:id="@+id/ad_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
</LinearLayout>
In the proper activity, in onCreate() method, include:
LinearLayout layout = (LinearLayout)findViewById(R.id.ad_layout);
//MCMCoreAdapter.getInstance().adWidth = +WIDTH+;
//MCMCoreAdapter.getInstance().adHeight = +HEIGHT+;
MCMCoreAdapter.getInstance().moduleAdsActivate(this, ADS_ID, layout);
layout.setGravity(Gravity.CENTER_HORIZONTAL);
layout.setVerticalGravity(Gravity.BOTTOM);
where "ADS_ID" is the ads identity obtained in Malcom. As you can see, there are two commented lines. By default, the ad banners size is 320x52. If you want to change the size just uncomment them and specify the values you want.
- Not Available Advertisements in Malcom. (Custom)
In this scenery, in Malcom Web we should have been previously created a "Custom Event". In Android application, you'll need to create a Java Class extending from "MCMAdEventhandler" like the following snippet:
package com.malcom.android.demo.app;
import android.app.Activity;
import com.malcom.library.android.module.ad.MCMAdEventHandler;
public class CustomEvent extends MCMAdEventHandler {
private Activity context;
public CustomEvent(Activity context) {
super();
this.context = context;
}
public void customAd() {
//TODO
}
}
The method name customAd() cannot be modified. Inside this method you should implement the chosen advertisement system.
The next step is to add to the desired activity layout the elements like the previous section. The only different thing is the way you call the method:
LinearLayout layout = (LinearLayout)findViewById(R.id.ad_layout);
//MCMCoreAdapter.getInstance().adWidth = +WIDTH+;
//MCMCoreAdapter.getInstance().adHeight = +HEIGHT+;
MCMCoreAdapter.getInstance().moduleAdAactivate(this, layout, new CustomEvent(this));
layout.setGravity(Gravity.CENTER_HORIZONTAL);
layout.setVerticalGravity(Gravity.BOTTOM);