gcm-sender-async

An asynchronous GCM server library.

License

License

GroupId

GroupId

org.whispersystems
ArtifactId

ArtifactId

gcm-sender-async
Last Version

Last Version

0.1.6
Release Date

Release Date

Type

Type

jar
Description

Description

gcm-sender-async
An asynchronous GCM server library.
Project URL

Project URL

https://github.com/WhisperSystems/gcm-sender-async
Source Code Management

Source Code Management

https://github.com/WhisperSystems/gcm-sender-async

Download gcm-sender-async

How to add to project

<!-- https://jarcasting.com/artifacts/org.whispersystems/gcm-sender-async/ -->
<dependency>
    <groupId>org.whispersystems</groupId>
    <artifactId>gcm-sender-async</artifactId>
    <version>0.1.6</version>
</dependency>
// https://jarcasting.com/artifacts/org.whispersystems/gcm-sender-async/
implementation 'org.whispersystems:gcm-sender-async:0.1.6'
// https://jarcasting.com/artifacts/org.whispersystems/gcm-sender-async/
implementation ("org.whispersystems:gcm-sender-async:0.1.6")
'org.whispersystems:gcm-sender-async:jar:0.1.6'
<dependency org="org.whispersystems" name="gcm-sender-async" rev="0.1.6">
  <artifact name="gcm-sender-async" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.whispersystems', module='gcm-sender-async', version='0.1.6')
)
libraryDependencies += "org.whispersystems" % "gcm-sender-async" % "0.1.6"
[org.whispersystems/gcm-sender-async "0.1.6"]

Dependencies

compile (3)

Group / Artifact Type Version
org.apache.httpcomponents : httpasyncclient jar 4.0.2
com.fasterxml.jackson.core : jackson-databind jar 2.9.8
com.nurkiewicz.asyncretry : asyncretry-jdk7 jar 0.0.5

test (4)

Group / Artifact Type Version
junit : junit jar 4.11
org.mockito : mockito-core jar 1.9.5
com.squareup.okhttp : mockwebserver jar 2.1.0
com.github.tomakehurst : wiremock jar 1.52

Project Modules

There are no modules declared in this project.

gcm-sender-async

An asynchronous HTTP library for Google Cloud Messaging.

Google provides a library for GCM (gcm-server), but it has a synchronous interface, along with an implementation that leaves something to be desired.

This is asynchronous, backed by Apache HttpAsyncClient, automatically handles asynchronous retries with backoff, simple to use, and fast.

Installing

Add to your pom:

<dependency>
  <groupId>org.whispersystems</groupId>
  <artifactId>gcm-sender-async</artifactId>
  <version>(latest version here)</version>
</dependency>

Using

String apiKey = "<myGcmApiKey>";
Sender sender = new Sender(apiKey);

ListenableFuture<Result> future = sender.send(Message.newBuilder()
                                                     .withDestination("<registration_id>")
                                                     .withDataPart("message", "hello world!");

Futures.addCallback(future, new FutureCallback<Result>() {
  @Override
  public void onSuccess(Result result) {
    if (result.isSuccess()) {
      // Maybe do something with result.getMessageId()
    } else {
      // Maybe do something with result.getError(), or check result.isUnregistered, etc..
    }
  }

  @Override
  public void onFailure(Throwable throwable) {
    // Handle network failure or server 500
  }
}

License

Copyright 2015 Open Whisper Systems

Licensed under the AGPLv3: https://www.gnu.org/licenses/agpl-3.0.html

org.whispersystems

Open Whisper Systems

The Signal repositories have moved to github.com/signalapp

Versions

Version
0.1.6
0.1.5
0.1.4
0.1.3