Skip to content

Instantly share code, notes, and snippets.

@matzew
Created February 20, 2014 14:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matzew/9115284 to your computer and use it in GitHub Desktop.
Save matzew/9115284 to your computer and use it in GitHub Desktop.

User Foo has these friends:

  • mr_wolf
  • marcellus.Wallace

Now something w/ Foo happened, and all the friends need to be send a mobile push notification.

curl -3 -u "{PushApplicationID}:{MasterSecret}"
   -v -H "Accept: application/json" -H "Content-type: application/json"
   -X POST

   -d '{
      "alias" : ["mr_wolf", "marcellus.Wallace"],
      "message": {"alert":"Foo has a new picture!"}
      }'

https://SERVER:PORT/CONTEXT/rest/sender

Or use the Java client we have:


  JavaSender defaultJavaSender =
  new SenderClient("http://localhost:8080/ag-push");
  
  UnifiedMessage unifiedMessage = new UnifiedMessage.Builder()
                .pushApplicationId("something")
                .masterSecret("something")
                .aliases(Arrays.asList("mr_wolf", "marcellus.Wallace"))
                .alert("Foo has a new picture!")
                .build();

 defaultJavaSender.send(unifiedMessage, optinalCallback); 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment