https://github.com/adorsys/pushit
this library is a normalized wrapper over GCM and APNs
https://github.com/adorsys/pushit
Last synced: about 1 month ago
JSON representation
this library is a normalized wrapper over GCM and APNs
- Host: GitHub
- URL: https://github.com/adorsys/pushit
- Owner: adorsys
- Created: 2016-06-30T14:41:59.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-06-30T15:29:32.000Z (over 9 years ago)
- Last Synced: 2025-08-21T16:15:10.888Z (about 2 months ago)
- Language: Java
- Homepage:
- Size: 67.4 KB
- Stars: 1
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pushit
## Usage
Add the BOM to your maven dependencyManagement:
```xml
de.adorsys.pushit
bom
0.2.0
pom
import
```
This defines the versions for all the pushit artefact as well as the apns and gcm implementations.
You can now add the dependencies:
```xml
de.adorsys.pushit
pushit
com.notnoop.apns
apns
com.google.gcm
gcm-server
```Example to send a simple message to an iOS and Android device:
```java
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import de.adorsys.pushit.apns.ApnsSender;
import de.adorsys.pushit.gcm.GcmSender;public class TestCommonMessageMain {
private static final Config conf = ConfigFactory.load();
private static final String keyFilename = conf.getString("apns.keyFile");
private static final String keyPassphrase = conf.getString("apns.keyPassphrase");
private static final String deviceToken = conf.getString("apns.deviceToken");
private static final String apiKey = conf.getString("gcm.apiKey");
private static final String registrationId = conf.getString("gcm.registrationId");public static void main(String[] args) {
ApnsSender apnsSender = ApnsSender.create(keyFilename, keyPassphrase);
GcmSender gcmSender = GcmSender.create(apiKey);
Dispatcher dispatcher = new Dispatcher.Builder().apnsSender(apnsSender).gcmSender(gcmSender).build();
Message.TextMessage message = new Message.TextMessage("Hi from pushit");
Receiver receiver = new Receiver.Builder().addApnsToken(deviceToken).addGcmToken(registrationId).build();
dispatcher.send(message, receiver);
}
}
```