Android Open Source - tapad-android-sdk Ad Response






From Project

Back to project page tapad-android-sdk.

License

The source code is released under:

MIT License

If you think the Android project tapad-android-sdk listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.tapad.adserving;
//w  ww . jav a 2 s.co  m
/**
 * Represents the result of an ad request.
 */
public class AdResponse {
    /**
     * Ad was successfully returned.
     */
    public static final int OK = 200;
    /**
     * No ad available at this time.
     */
    public static final int NO_AD_AVAILABLE = 204;
    /**
     * An error (e.g network connectivity error) occurred when requesting the ad.
     */
    public static final int ERROR = 100;

    private int responseCode;
    private String markup;
    private String message;

    AdResponse(int responseCode, String markup, String message) {
        this.responseCode = responseCode;
        this.markup = markup;
        this.message = message;
    }

    /**
     * Returns the response code.
     * @return one of the defined response codes.
     */
    public int getResponseCode() {
        return responseCode;
    }

    /**
     * Returns the markup.
     * @return the markup if the responseCode is OK, or null otherwise.
     */
    public String getMarkup() {
        return markup;
    }

    /**
     * Returns the message associated with an error status.
     *
     * @return the error message if the responseCode is ERROR, or null otherwise.
     */
    public String getMessage() {
        return message;
    }

    @Override
    public String toString() {
        return "AdResponse[status=" + responseCode + ",markup=" + markup + "]";
    }

    static AdResponse success(String markup) {
        return new AdResponse(OK, markup, null);
    }

    static AdResponse noAdAvailable() {
        return new AdResponse(NO_AD_AVAILABLE, null, null);
    }
    
    static AdResponse error(String message) {
        return new AdResponse(ERROR, null, message);
    }
}




Java Source Code List

com.tapad.adserving.AdRequestDispatcher.java
com.tapad.adserving.AdRequest.java
com.tapad.adserving.AdResource.java
com.tapad.adserving.AdResponse.java
com.tapad.adserving.AdServingServiceImpl.java
com.tapad.adserving.AdServingService.java
com.tapad.adserving.AdServing.java
com.tapad.adserving.AdSize.java
com.tapad.adserving.ui.AdView.java
com.tapad.sample.AdViewActivity.java
com.tapad.sample.MainActivity.java
com.tapad.sample.MainApplication.java
com.tapad.sample.ManualMarkupActivity.java
com.tapad.sample.SampleConstants.java
com.tapad.tracking.DeviceIdentifier.java
com.tapad.tracking.DeviceInfo.java
com.tapad.tracking.EventDispatcher.java
com.tapad.tracking.EventResource.java
com.tapad.tracking.Event.java
com.tapad.tracking.InstallReferrerReceiver.java
com.tapad.tracking.TrackingServiceImpl.java
com.tapad.tracking.TrackingService.java
com.tapad.tracking.Tracking.java
com.tapad.tracking.deviceidentification.AndroidId.java
com.tapad.tracking.deviceidentification.IdentifierSourceAggregator.java
com.tapad.tracking.deviceidentification.IdentifierSource.java
com.tapad.tracking.deviceidentification.PhoneId.java
com.tapad.tracking.deviceidentification.TypedIdentifier.java
com.tapad.tracking.deviceidentification.WifiMac.java
com.tapad.util.DigestUtil.java
com.tapad.util.HttpClientUtil.java
com.tapad.util.IoUtil.java
com.tapad.util.Logging.java