Skip to content

Instantly share code, notes, and snippets.

@sebastienblanc
Last active December 19, 2015 06:09
Show Gist options
  • Save sebastienblanc/5908973 to your computer and use it in GitHub Desktop.
Save sebastienblanc/5908973 to your computer and use it in GitHub Desktop.
Map categories = new HashMap();
categories.put("lead", "version="+leadVersion++); 
Map json = new HashMap();
json.put("id", lead.getId());
json.put("messageType", "pushed_lead");
json.put("name", lead.getName());
json.put("location", lead.getLocation());
json.put("phone", lead.getPhoneNumber());
json.put("simple-push", categories);
json.put("sound" ,"default");
json.put("alert" ,"A new lead has been created");
Message message = new Message();
message.setClientIdentifiers("jake","maria");
message.enableSound();//by default use "default" or we could do message.enableSound("boing")
message.setAlert("Watch out!);
message.setAttribute("customAttribute","yo"); // custom simple strings
message.setAttribute("customStructure",myObject); // passing objects

Message message = new Message().builder()
  .clientIdentifiers("jake","maria")
  .enableSound()
  .alert("AAAAHHH!")
  .attribute("customAttribute","yo")
  .attribute("customStructure",myObject)
  .build()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment