Skip to content
Ferran Maylinch edited this page Nov 22, 2013 · 10 revisions

How to add Malcom Campaigns

Malcom campaigns are banners that let you measure impressions and clicks.

In order to display a campaign inside an activity, add this UI element in the activity's layout:

<RelativeLayout
    android:id="@+id/campaign_banner_layout"
    android:layout_width="fill_parent"
    android:layout_height="300dip">
</RelativeLayout>

Cross-selling campaigns

This kind of campaigns are designed to promote one app from another app. It lets you measure the impact of the campaign in number of downloads.

To add a cross-selling campaign to your activity:

MCMCoreAdapter.getInstance().moduleCampaignAddCrossSelling(this);

By default, campaign banners in Malcom stay on screen for 15 seconds. You can change the duration and other parameters with this method:

MCMCoreAdapter.getInstance().moduleCampaignAddCrossSelling(this, this, 20, R.drawable.loading_image);

The second parameter is the MCMCampaignNotifiedDelegate that will be notified with the campaign actions. The third parameter is the duration of the campaign (0 means it will stay on screen forever). The last parameter is the placeholder image that will be shown while the remote resource is being downloaded.

Promotion campaigns

The promotion campaigns are designed to display a custom promotion inside your application. To add a promotion campaign to your activity (also you can use the simplified methods):

MCMCoreAdapter.getInstance().moduleCampaignAddPromotion(this, this, R.drawable.loading_image);

Rate my app campaign

The rate my app campaign displays a dialog that asks the user to rate the application in the store. All the configuration about number of times to ask or days before asking again are set on the Malcom web so in your app you only need to call this method:

MCMCoreAdapter.getInstance().moduleCampaignAddRateMyApp(this, callback);

Where the first parameter is the activity where the dialog will be shown and the second is the interface that will be called when the user press one of the options (you can implement it in the same activity).

In order to customize the texts for the dialog, you can add these entries to your string.xml file:

<string name="malcom_rate_title">Your title</string>
<string name="malcom_rate_message">Your message</string>
<string name="malcom_rate_button">Your rate button title</string>
<string name="malcom_remind_button">Your remind button title</string>
<string name="malcom_disable_button">Your disable button title</string>

Perform custom behavior

You can use the Malcom's campaigns to show more than one campaign at same time inside your application (for example a list of promotions or apps). You can request all the campaigns of one type (cross selling or promotion) using the following method to get an array with all the banners promotions and add the views where you want:

MCMCoreAdapter.getInstance().moduleCampaignRequestPromotion(activity, requestCampaignReceiver)

You can even use custom params to filter the received campaigns and show only those that you want. There is a CampaignDTO object inside the view with the campaign's data:

bannerView.getCampaign();

To show a banner you only need to add the CampaignBannerView to the layout where you want to show it. For example:

yourLayout.addView(bannerView);    
Clone this wiki locally