public interface NotificationCallback extends Serializable
UnparsedNotifications after subscribing to a topic.
Must not be implemented in form of an anonymous class as this will break serialization.
Should be thread-safe as several notifications might be processed at the same time.
State will only be persisted once when a subscription is created. All state changes occurring
during the .handleNotification(..) call will be lost.
class MyNotificationCallback extends NotificationCallback {
void handleNotification(
Subscription subscription, UnparsedNotification notification) {
if (notification.getEventType().equals(EventTypes.UPDATED)) {
// add items in the notification to the local client state ...
}
}
}
...
myRequest.subscribe(new MyNotificationCallback()).execute();
| Modifier and Type | Method and Description |
|---|---|
void |
handleNotification(StoredSubscription subscription,
UnparsedNotification notification)
Handles a received push notification.
|
void handleNotification(StoredSubscription subscription, UnparsedNotification notification) throws IOException
subscription - Subscription to which this notification belongsnotification - Notification which was delivered to this applicationIOExceptionCopyright © 2010-2013 Google. All Rights Reserved.