// Android configuration:
var pushConfig = {
pushServerURL: "https://ups.server.com/",
alias:"someuser@mail.com" ,
categories: ["JBoss", "mobile"],
android: {
senderID: "GOOGLE ID",
variantID: "1234541",
variantSecret: "234213123"
}
};
// execute registration
push.register(onNotification, successHandler, errorHandler,
pushConfig);
final PushSender sender = DefaultPushSender.withRootServerURL(...)
.pushApplicationId(...)
.masterSecret(...)
.build();
final UnifiedMessage unifiedMessage = UnifiedMessage.withMessage()
.alert("We have a problem!")
.sound("default")
.criteria()
.aliases(Arrays.asList("Mr. Wolf", "Marcellus Wallace"))
.build();
// Java8 compliant, functional interface
sender.send(unifiedMessage, () ->
logger.info("successful delivery to UPS returned")
);
function onNotification(event) {
if (event.payload.task === "NEW_LEAD") {
var latitude = event.payload.latitude;
var longitude = event.payload.longitude;
// draw something on a map:
showCustomerLoc(latitude, longitude);
}
// more checks....
}