com.citygrid.ads.mobile
Class CGAdsMobile

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

public class CGAdsMobile
extends Object
implements Serializable, Cloneable

The Mobile Ads SDK allows you to show a mobile ad directly in your app that is similar in size to other ad providers. You can then present a detail and track actions similarly to Custom Ads.

To use this API, it is necessary to provide the mobile device' MUID. Let's pretend you wanted to present a restaurant banner add for an mobile device based on the latitude and longitude of the device.

 
CityGrid.setPublisher("test");
    CityGrid.setSimulation(false);
    CityGrid.setMuid(YOUR_MUID);

    CGAdsMobile search = CityGrid.adsMobile();
    search.setWhat("restaurant");
    search.setLatlon(new CGLatLon(33.786594d, -118.298662d));
    search.setRadius(50.0f);
    search.setCollection(CGAdsMobileCollection.Collection640x100);
    search.setSize(new CGSize(640.0f, 100.0f));

    CGAdsMobileResults results = search.banner();
    for (CGAdsMobileAd ad : results.getAds()) {
        // do something with the ad
    }

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

CGAdsMobileAd 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 CGAdsMobileBannerUri
           
private  CGAdsMobileCollection collection
           
private  int connectTimeout
           
private  String impressionId
           
private  CGLatLon latlon
           
private  int max
           
private  String muid
           
private  String placement
           
private  String publisher
           
private  float radius
           
private  String rawWhat
           
private  String rawWhere
           
private  int readTimeout
           
private  CGSize size
           
private  String ua
           
private  String what
           
private  String where
           
 
Constructor Summary
CGAdsMobile(String publisher)
           
 
Method Summary
static CGAdsMobile adsMobile()
           
static CGAdsMobile adsMobileWithPlacement(String placement)
           
static CGAdsMobile adsMobileWithPublisher(String publisher)
           
static CGAdsMobile adsMobileWithPublisherAndPlacement(String publisher, String placement)
           
 CGAdsMobileResults banner()
           
private  Map<String,Object> build()
           
 Object clone()
           
 boolean equals(Object o)
           
 CGAdsMobileCollection getCollection()
           
 int getConnectTimeout()
           
 String getImpressionId()
           
 CGLatLon getLatlon()
           
 int getMax()
           
 String getMuid()
           
 String getPlacement()
           
 String getPublisher()
           
 float getRadius()
           
 String getRawWhat()
           
 String getRawWhere()
           
 int getReadTimeout()
           
 CGSize getSize()
           
 String getUa()
           
 String getWhat()
           
 String getWhere()
           
 int hashCode()
           
private  CGAdsMobileAd[] processAds(org.codehaus.jackson.JsonNode parsedAds)
           
private  CGAdsMobileResults processResults(org.codehaus.jackson.JsonNode parsedJson)
           
 void setCollection(CGAdsMobileCollection collection)
           
 void setConnectTimeout(int connectTimeout)
           
 void setImpressionId(String impressionId)
           
 void setLatlon(CGLatLon latlon)
           
 void setMax(int max)
           
 void setMuid(String muid)
           
 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 setSize(CGSize size)
           
 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

CGAdsMobileBannerUri

private static final String CGAdsMobileBannerUri
See Also:
Constant Field Values

publisher

private String publisher

collection

private CGAdsMobileCollection collection

ua

private String ua

rawWhat

private String rawWhat

rawWhere

private String rawWhere

what

private String what

where

private String where

latlon

private CGLatLon latlon

radius

private float radius

max

private int max

placement

private String placement

impressionId

private String impressionId

size

private CGSize size

connectTimeout

private int connectTimeout

readTimeout

private int readTimeout

muid

private String muid
Constructor Detail

CGAdsMobile

public CGAdsMobile(String publisher)
Method Detail

adsMobile

public static CGAdsMobile adsMobile()

adsMobileWithPublisher

public static CGAdsMobile adsMobileWithPublisher(String publisher)

adsMobileWithPlacement

public static CGAdsMobile adsMobileWithPlacement(String placement)

adsMobileWithPublisherAndPlacement

public static CGAdsMobile adsMobileWithPublisherAndPlacement(String publisher,
                                                             String placement)

validate

private List<CGError> validate()

build

private Map<String,Object> build()

processAds

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

processResults

private CGAdsMobileResults processResults(org.codehaus.jackson.JsonNode parsedJson)

banner

public CGAdsMobileResults banner()
                          throws CGException
Throws:
CGException

getPublisher

public String getPublisher()

setPublisher

public void setPublisher(String publisher)

getCollection

public CGAdsMobileCollection getCollection()

setCollection

public void setCollection(CGAdsMobileCollection collection)

setUa

public void setUa(String ua)

getUa

public String getUa()

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)

getLatlon

public CGLatLon getLatlon()

setLatlon

public void setLatlon(CGLatLon latlon)

getRadius

public float getRadius()

setRadius

public void setRadius(float radius)

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)

getSize

public CGSize getSize()

setSize

public void setSize(CGSize size)

getConnectTimeout

public int getConnectTimeout()

setConnectTimeout

public void setConnectTimeout(int connectTimeout)

getReadTimeout

public int getReadTimeout()

setReadTimeout

public void setReadTimeout(int readTimeout)

getMuid

public String getMuid()

setMuid

public void setMuid(String muid)

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.