Android
From Mocean Mobile Wiki
Contents |
Parameters for the android SDK
Please make sure to set site/zone/appId for your request. Failure to properly set either of those parameters will lead to default ad being displayed.
Parameters for android SDK:
/**
* Creation of viewer of advertising.
* @param context - The reference to the context of Activity.
* @param isUseCache - Use cache for Ad or not.
* @param isInternalBrowser - The flag which operates advertising opening. False - Ad opens in an external browser. True - Ad opening at the help of a adClickListener.
* @param adClickListener - The interface for advertising opening.
* @param defaultImage - The identifier of the resource, which will be shown during advertising loading if there is no advertising in a cache.
* @param adReloadPeriod - The period of an automatic reload of advertising (in milliseconds).
* @param appId - The id of the application.
* @param campaign - campaign.
* @param mode - Mode of viewer of advertising (use MODE_COUNTER_ONLY, MODE_ADS_ONLY, MODE_COUNTER_AND_ADS).
* @param site - The id of the publisher site.
* @param zone - The id of the zone of publisher site.
* @param ip - The IP address of the carrier gateway over which the device is connecting.
* @param keywords - Keywords to search ad delimited by commas.
* @param adstype - Type of advertisement (ADS_TYPE_TEXT_ONLY - text only, ADS_TYPE_IMAGES_ONLY - image only, ADS_TYPE_TEXT_AND_IMAGES - image and text, ADS_TYPE_SMS - SMS ad). SMS will be returned in XML.
* @param over18 - Filter by ad over 18 content (OVER_18_TYPE_DENY - deny over 18 content , OVER_18_TYPE_ONLY - only over 18 content, OVER_18_TYPE_ALL - allow all ads including over 18 content).
* @param latitude - Latitude.
* @param longitude - Longitude.
* @param ua - The browser user agent of the device making the request.
* @param premium - Filter by premium (PREMIUM_STATUS_NON_PREMIUM - non-premium, PREMIUM_STATUS_PREMIUM - premium only, PREMIUM_STATUS_BOTH - both). Can be used only by premium publishers.
* @param key - Output format. Normal format uses key = OUTPUT_FORMAT_NORMAL. Parameter key should be set to OUTPUT_FORMAT_XML in order to use XML output and to OUTPUT_FORMAT_JSON in order to use JSON output.
* @param isTestModeEnabled - Setting is test mode where, if the ad code is true, the ad response is "Test MODE".
* @param count - Quantity of ads, returned by a server. Maximum value is 5.
* @param country - Country of visitor (for example: US).
* @param region - Region of visitor (for example: NY).
* @param isTextborderEnabled - Show borders around text ads (false - non-borders, true - show borders).
* @param paramBorder - Borders color (for example: #000000).
* @param paramBG - Background color in borders (for example: #ffffff).
* @param paramLINK - Text color (for example: #ffffff).
* @param carrier - Carrier name.
* @param imageSize - Override size detection for banners (IMAGE_SIZE_SMALLEST - the smallest, IMAGE_SIZE_LARGEST - the largest).
* @param target - Target attribute for HTML link element (TARGET_BLANK - open the linked document in a new window, TARGET_SELF - open the linked document in the same frame, TARGET_PARENT - open the linked document in the parent frameset, TARGET_TOP - open the linked document in the full body of the window).
* @param url - URL of site for which it is necessary to receive advertising.
* @param isPixelModeEnabled - If true, return redirect to image for ad (or tracking pixel 1x1) directly (instead of html response).
*/
Setting up the development environment for android
Making an ad request using the android SDK
public class MoceanAndroid extends Activity {
/** Called when the activity is first created. */
LinearLayout linearLayout;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
AdserverView adserverView = new AdserverView(this, false,
true, null, R.drawable.test_banner, 10000L,
"abCdefG", "52352", AdserverView.MODE_ADS_ONLY,
"5441", "6365", "1.1.1.1", null, AdserverView.ADS_TYPE_TEXT_AND_IMAGES, null,
null, null, null, null, null, false, null, null, null,
null, null, null, null, null, AdserverView.IMAGE_SIZE_LARGEST, null, null, null);
adserverView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, 50));
linearLayout = (LinearLayout) findViewById(R.id.LinearLayout01);
linearLayout.addView(adserverView);
}
}
