Push Sender

Push Sender is a library that allows you to quickly send push messages via APNS or GCM, on your Java powered servers.

License

License

GroupId

GroupId

com.devsu
ArtifactId

ArtifactId

push-sender
Last Version

Last Version

1.0.3
Release Date

Release Date

Type

Type

jar
Description

Description

Push Sender
Push Sender is a library that allows you to quickly send push messages via APNS or GCM, on your Java powered servers.
Project URL

Project URL

https://github.com/devsu/push-sender
Source Code Management

Source Code Management

https://github.com/devsu/push-sender

Download push-sender

How to add to project

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

Dependencies

compile (3)

Group / Artifact Type Version
com.notnoop.apns : apns jar 1.0.0.Beta6
com.ganyo : gcm-server jar 1.0.2
org.slf4j : slf4j-simple jar 1.7.13

test (1)

Group / Artifact Type Version
junit : junit jar 4.11

Project Modules

There are no modules declared in this project.

Push Sender [DEPRECATED]#

Push Sender is a Java library that allows sending push messages easily, based on the awesome libraries gcm-server by theganyo and java-apns by notnoop. Be sure to check them out! Send push messages with one line of code, forget about the rest, and focus on making your application's business logic!

Overview

Using Push Sender is very simple. You can import Push Sender on your POM file using:

	<dependency>
		<groupId>com.devsu</groupId>
		<artifactId>push-sender</artifactId>
		<version>1.0.3</version>
	</dependency>

Synchronous and asynchronous push services

You can send your push messages synchronously and asynchronously by choosing any of the implementations of PushService.

public class MySender {

	SyncAndroidPushService syncAndroidService = new SyncAndroidPushService(GCM_API_KEY);
	AsyncAndroidPushService asyncAndroidService = new SyncAndroidPushService(GCM_API_KEY, null);
	
	SyncApplePushService syncAppleService = new SyncApplePushService(P12_FILEPATH, P12_PASSWORD, IS_PRODUCTION_ENVIRONMENT);
	AsyncApplePushService asyncAppleService = new AsyncApplePushService(P12_FILEPATH, P12_PASSWORD, IS_PRODUCTION_ENVIRONMENT, null);
	
	...
	
	public void sendSomePushMessages() {
		String title = "My Push Message Title";
		String content = "Hello! This is a push message!";
		
		syncAndroidService.sendPush(title, content, ANDROID_PUSH_TOKEN);
		asyncAndroidService.sendPush(title, content, ANDROID_PUSH_TOKEN);
		
		syncAppleService.sendPush(title, content, IOS_PUSH_TOKEN);
		asyncAppleService.sendPush(title, content, IOS_PUSH_TOKEN);
	}

	...
}

PushCallback

You can implement a PushCallback for any of the asynchronous services.

public class MySender {

	...
		
	public void sendSomePushMessages() {
		AsyncAndroidPushService asyncAndroidService = new SyncAndroidPushService(GCM_API_KEY, new PushCallback() {
			
			@Override
			public void onSingleSuccess(boolean result, String title, String message, 
					Map<String, String> additionalFields, String token) {
				System.out.println("The single message was successfully sent!");
			}
			
			@Override
			public void onError(Throwable t) {
				System.err.println("Oops... Something happened!");
			}
			
			@Override
			public void onBulkSuccess(boolean result, String title, String message, 
					Map<String, String> additionalFields, String[] tokens) {
				System.out.println("The bulk message was successfully sent!");
			}
		});
	}

	...
}

Customizing

  • You can customize any data sent on your push message with a Map<String, String> that contains any key-value pair you want to send.
  • You can build your Message.Builder or PayloadBuilder objects externally and send them as push messages!
  • You can customize settings like max retries, collapse keys, production/sandbox environments, bulk size when sending simultaneous push messages on Android and more...

Authors

Feel free to contact Alvaro López at [email protected]!

License

Copyright 2015 Devsu Software

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

com.devsu

Devsu

Versions

Version
1.0.3
1.0.2
1.0.1
1.0.0