public class GCMForChromePushNotificationSender extends Object implements PushNotificationSender
| Constructor and Description |
|---|
GCMForChromePushNotificationSender() |
| Modifier and Type | Method and Description |
|---|---|
protected String |
fetchAccessToken(ChromePackagedAppVariant chromePackagedAppVariant) |
protected HttpURLConnection |
getConnection(String url)
Convenience method to open/establish a HttpURLConnection.
|
protected static String |
getString(InputStream stream)
Convenience method to convert an InputStream to a String.
|
protected HttpURLConnection |
post(String url,
String body,
String accessToken)
Returns HttpURLConnection that 'posts' the given body to the given URL.
|
protected HttpURLConnection |
refreshAccessToken(ChromePackagedAppVariant chromePackagedAppVariant) |
void |
sendPushMessage(Variant variant,
Collection<String> tokens,
UnifiedPushMessage pushMessage,
NotificationSenderCallback callback)
Sends the
UnifiedPushMessage to the given clients, identified by a collection of tokens, the underlying push network. |
public void sendPushMessage(Variant variant, Collection<String> tokens, UnifiedPushMessage pushMessage, NotificationSenderCallback callback)
PushNotificationSenderUnifiedPushMessage to the given clients, identified by a collection of tokens, the underlying push network.sendPushMessage in interface PushNotificationSendervariant - contains details for the underlying push network, e.g. API Keys/Idstokens - platform specific collection of client identifierspushMessage - payload to be send to the given clientscallback - invoked after submitting the request to the underlying push network to indicate the status
of the request (success or errorprotected HttpURLConnection post(String url, String body, String accessToken) throws IOException
IOExceptionprotected HttpURLConnection refreshAccessToken(ChromePackagedAppVariant chromePackagedAppVariant) throws IOException
IOExceptionprotected String fetchAccessToken(ChromePackagedAppVariant chromePackagedAppVariant)
chromePackagedAppVariant - protected HttpURLConnection getConnection(String url) throws IOException
IOExceptionprotected static String getString(InputStream stream) throws IOException
If the stream ends in a newline character, it will be stripped.
IOExceptionCopyright © 2014 JBoss by Red Hat. All Rights Reserved.