diff --git a/README.markdown b/README.markdown index 0907c3c..a0ba371 100644 --- a/README.markdown +++ b/README.markdown @@ -29,19 +29,35 @@ To send a notification, you can do it in two steps: C2DMService service = C2DM.newService() - .withAuthToken(("serviceAuthenticationToken") + .withAuthToken("serviceAuthenticationToken") .build(); 2. Create and send the message C2DMNotification notification = C2DM.newNotification() - .collapseKey("daily_message").delayWhileIdle(true) - .build(); + .collapseKey("daily_message") + .data("payload", "Here be dragons (or another message)") + .delayWhileIdle(true) + .build(); String registrationId = "deviceRegistrationID"; service.push(registrationId, notification); +(Read http://stackoverflow.com/questions/4164921/who-provides-auth-token-to-use-with-c2dm in order to get the serviceAuthenticationToken) + That's it! +On the device, you will be able to recieve the message by doing this: + + @Override + protected void onMessage(Context context, Intent intent) { + //Extract the payload from the message + Bundle extras = intent.getExtras(); + if (extras != null) { + System.out.println(extras.get("payload")); //Will print to the logcat + // Do something with the data you recieved + } + } + Features In the Making --------------------------- * Auto retries (exponential back-off feature)