com.citygrid.ads.custom
Class CGAdsCustom

java.lang.Object
  extended by com.citygrid.ads.custom.CGAdsCustom
All Implemented Interfaces:
Serializable, Cloneable

public class CGAdsCustom
extends Object
implements Serializable, Cloneable

The Custom Ads SDK allows you to build custom ads and featured details in your application. It allows you have preferred placement for local advertisers to help you earn money directly on the page.

Let's pretend you want to present a restaurant custom ad based on the latitude and longitude of the device.

CGAdsCustom search = CityGrid.adsCustom();
    search.setWhat("restaurant");
    search.setLatlon(new CGLatLon(34.0522222d, -118.2427778d));
    search.setRadius(20.0f);

    CGAdsCustomResults results = search.search();
    for (CGAdsCustomAd ad : results.getAds()) {
        // do something with the add
    }

Next, we'll pretend the user clicked on the ad and you wish to show a detail to help you monetize.

CGAdsCustomAd ad = results.getAd();
    CGPlacesDetailLocation detailLocation = ad.placesDetailLocation();
    // do something with the detail location, maybe even track it CGPlacesDetailLocation.track(muid, mobileType).

See Also:
Serialized Form

Field Summary
private static String CGAdsCustomLatLonUri
           
private static String CGAdsCustomWhereUri
           
private  int connectTimeout
           
private  String impressionId
           
private  CGLatLon latlon
           
private  int max
           
private  String placement
           
private  String publisher
           
private  float radius
           
private  String rawWhat
           
private  String rawWhere
           
private  int readTimeout
           
private  String serveUrl
           
private  String ua
           
private  String what
           
private  String where
           
 
Constructor Summary
CGAdsCustom(String publisher)
           
 
Method Summary
static CGAdsCustom adsCustom()
           
static CGAdsCustom adsCustomWithPlacement(String placement)
           
static CGAdsCustom adsCustomWithPublisher(String publisher)
           
static CGAdsCustom adsCustomWithPublisherAndPlacement(String publisher, String placement)
           
private  Map<String,Object> build()
           
 Object clone()
           
 boolean equals(Object o)
           
 int getConnectTimeout()
           
 String getImpressionId()
           
 CGLatLon getLatlon()
           
 int getMax()
           
 String getPlacement()
           
 String getPublisher()
           
 float getRadius()
           
 String getRawWhat()
           
 String getRawWhere()
           
 int getReadTimeout()
           
 String getServeUrl()
           
 String getUa()
           
 String getWhat()
           
 String getWhere()
           
 int hashCode()
           
private  CGAdsCustomAd[] processAds(org.codehaus.jackson.JsonNode parsedAds)
           
private  CGAdsCustomResults processResults(org.codehaus.jackson.JsonNode rootNode)
           
 CGAdsCustomResults search()
           
 void setConnectTimeout(int connectTimeout)
           
 void setImpressionId(String impressionId)
           
 void setLatlon(CGLatLon latlon)
           
 void setMax(int max)
           
 void setPlacement(String placement)
           
 void setPublisher(String publisher)
           
 void setRadius(float radius)
           
 void setRawWhat(String rawWhat)
           
 void setRawWhere(String rawWhere)
           
 void setReadTimeout(int readTimeout)
           
 void setServeUrl(String serveUrl)
           
 void setUa(String ua)
           
 void setWhat(String what)
           
 void setWhere(String where)
           
 String toString()
           
private  List<CGError> validate()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CGAdsCustomWhereUri

private static final String CGAdsCustomWhereUri
See Also:
Constant Field Values

CGAdsCustomLatLonUri

private static final String CGAdsCustomLatLonUri
See Also:
Constant Field Values

publisher

private String publisher

ua

private String ua

serveUrl

private String serveUrl

rawWhat

private String rawWhat

rawWhere

private String rawWhere

what

private String what

where

private String where

max

private int max

placement

private String placement

impressionId

private String impressionId

latlon

private CGLatLon latlon

radius

private float radius

connectTimeout

private int connectTimeout

readTimeout

private int readTimeout
Constructor Detail

CGAdsCustom

public CGAdsCustom(String publisher)
Method Detail

adsCustom

public static CGAdsCustom adsCustom()

adsCustomWithPublisher

public static CGAdsCustom adsCustomWithPublisher(String publisher)

adsCustomWithPlacement

public static CGAdsCustom adsCustomWithPlacement(String placement)

adsCustomWithPublisherAndPlacement

public static CGAdsCustom adsCustomWithPublisherAndPlacement(String publisher,
                                                             String placement)

search

public CGAdsCustomResults search()
                          throws CGException
Throws:
CGException

processResults

private CGAdsCustomResults processResults(org.codehaus.jackson.JsonNode rootNode)

processAds

private CGAdsCustomAd[] processAds(org.codehaus.jackson.JsonNode parsedAds)

validate

private List<CGError> validate()

build

private Map<String,Object> build()

getPublisher

public String getPublisher()

setPublisher

public void setPublisher(String publisher)

getUa

public String getUa()

setUa

public void setUa(String ua)

getServeUrl

public String getServeUrl()

setServeUrl

public void setServeUrl(String serveUrl)

getRawWhat

public String getRawWhat()

setRawWhat

public void setRawWhat(String rawWhat)

getRawWhere

public String getRawWhere()

setRawWhere

public void setRawWhere(String rawWhere)

getWhat

public String getWhat()

setWhat

public void setWhat(String what)

getWhere

public String getWhere()

setWhere

public void setWhere(String where)

getMax

public int getMax()

setMax

public void setMax(int max)

getPlacement

public String getPlacement()

setPlacement

public void setPlacement(String placement)

getImpressionId

public String getImpressionId()

setImpressionId

public void setImpressionId(String impressionId)

getLatlon

public CGLatLon getLatlon()

setLatlon

public void setLatlon(CGLatLon latlon)

getRadius

public float getRadius()

setRadius

public void setRadius(float radius)

getConnectTimeout

public int getConnectTimeout()

setConnectTimeout

public void setConnectTimeout(int connectTimeout)

getReadTimeout

public int getReadTimeout()

setReadTimeout

public void setReadTimeout(int readTimeout)

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

clone

public Object clone()
             throws CloneNotSupportedException
Overrides:
clone in class Object
Throws:
CloneNotSupportedException


Copyright © 2011. All Rights Reserved.