Coder Social home page Coder Social logo

java-library's Introduction

Urban Airship Java Client Library

This is the official supported Java library for the Urban Airship API.

Using the library is straightforward. Create a client, setup a request payload, handle the results.

    String appKey = "appKey";
    String appSecret = "appSecret";

    // Setup an authenticated APIClient with your application key and
    // application master secret.
    APIClient apiClient = APIClient.newBuilder()
            .setKey(appKey)
            .setSecret(appSecret)
            .build();

    // Setup a push payload to send to the API with our handy builders
    PushPayload payload = PushPayload.newBuilder()
            .setAudience(Selectors.all())
            .setNotification(Notifications.notification("UA Push"))
            .setDeviceTypes(DeviceTypeData.of(DeviceType.IOS))
            .build();
    // Try and send, handle anything that comes up
    try {
        APIClientResponse<APIPushResponse> response = apiClient.push(payload);
        logger.info("Sent a push message!");
    }
    // Non 200 responses throw an APIRequestException. Check the documentation
    // to debug your request.
    catch (APIRequestException ex){
        logger.error("Non 200 request, checking error details and taking action");
    }
    // An underlying error occurred, most likely outside of the scope of the
    // UA library, do some HTTP debugging
    catch (IOException e){
        logger.error("Broken pipe what?");
    }

Documentation

General documentation can be found here: http://docs.urbanairship.com/ Java client library documentation can be found here: http://docs.urbanairship.com/reference/libraries/java/index.html

Installation

Manual installation

Clone the repository, and use

    mvn package

to build the jar. Add the jar, located at a path similar to:

    target/java-client-<version>.jar

If you would like a copy of the javadocs, use

    mvn javadoc:javadoc

Maven Installation

Add the following to your pom.xml

    <!-- Urban Airship Library Dependency-->
    <dependency>
        <groupId>com.urbanairship</groupId>
        <artifactId>java-client</artifactId>
        <version>0.2.VERSION</version>
        <!-- Replace VERSION with the version you want to use -->
    </dependency>

Examples

There is an example project in the examples directory with code to send a push, a scheduled push, logging, and Maven integration.

Full documentation: http://docs.urbanairship.com/reference/libraries/java/index.html

java-library's People

Contributors

mhooge avatar ptseng avatar pdxmele avatar z0br0wn avatar rlubbat avatar robotadam avatar vitaminmoo avatar jrylander avatar alotor avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.