CityGrid SDK 2.2.1-SNAPSHOT API

CityGrid Java SDK

See:
          Description

Packages
com.citygrid  
com.citygrid.ads.custom  
com.citygrid.ads.mobile  
com.citygrid.ads.tracker  
com.citygrid.content  
com.citygrid.content.offers  
com.citygrid.content.offers.detail  
com.citygrid.content.offers.search  
com.citygrid.content.places.detail  
com.citygrid.content.places.search  
com.citygrid.content.reviews  

 

CityGrid Java SDK

Introduction

Welcome to the CityGrid SDK Documentation for Java/Android. Using the CityGrid SDK, you can access and display local content and advertising on your Java and Android application. This CityGrid SDK and Documentation uses and mirrors the publicly available REST API's available at docs.citygridmedia.com.

The SDK removes all of the busy work of network calls as well as data parsing into Java objects.

Installation

The CityGrid SDK is available as a jar. This makes it relatively easy to include in a project. To download the jar directly, follow this link. If you use maven, simply put the following in your pom.xml.

  <dependency>
    <groupId>com.citygrid</groupId>
    <artifactId>citygrid</artifactId>
    <version>[VERSION]</version>
  </dependency>

Getting Started

To start use the SDK, simply configure CityGrid with your CityGrid publisher code. The SDK has a default simulation mode, under which hard coded (aka simulated data) will be returned. To turn simulation mode off, simply call CityGrid.setSimulation(false). In addition it is recommended you specify a default network timeout and placement. Placement is field used to help aggregate reports.

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

NOTE: The CityGrid SDK is synchronous in nature. All calls using the SDK should be performed on a background thread. This is best managed by your application.

The SDK offers API classes that closely mirrors the REST APIs at docs.citygridmedia.com. To obtain such an API class, simple call the static method on CityGrid class.

    CGPlacesSearch search = CityGrid.placesSearch();
    search.setType(CGPlacesSearchType.MovieTheater);
    search.setWhere("90045");
    search.setHistograms(true);

    try {
        CGPlacesSearchResults results = search(search);
    }
    catch (CGException e) {
        log.error("Something went wrong", e);
    }



Copyright © 2011. All Rights Reserved.