Beta
Callback to receive notifications for watched resource in which the . Callback which is used to
receive typed AbstractNotifications after subscribing to a topic.
Must NOT be implemented in form of an anonymous class as this will break serialization.
Implementation should be thread-safe. Example usage:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# Package com.google.api.client.googleapis.notifications (2.8.1)\n\nVersion latestkeyboard_arrow_down\n\n- [2.8.1 (latest)](/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.notifications)\n- [2.8.0](/java/docs/reference/google-api-client/2.8.0/com.google.api.client.googleapis.notifications)\n- [2.7.2](/java/docs/reference/google-api-client/2.7.2/com.google.api.client.googleapis.notifications)\n- [2.6.0](/java/docs/reference/google-api-client/2.6.0/com.google.api.client.googleapis.notifications)\n- [2.5.1](/java/docs/reference/google-api-client/2.5.1/com.google.api.client.googleapis.notifications)\n- [2.4.1](/java/docs/reference/google-api-client/2.4.1/com.google.api.client.googleapis.notifications)\n- [2.1.2](/java/docs/reference/google-api-client/2.1.2/com.google.api.client.googleapis.notifications)\n- [2.0.1](/java/docs/reference/google-api-client/2.0.1/com.google.api.client.googleapis.notifications)\n- [1.35.2](/java/docs/reference/google-api-client/1.35.2/com.google.api.client.googleapis.notifications)\n- [1.34.1](/java/docs/reference/google-api-client/1.34.1/com.google.api.client.googleapis.notifications)\n- [1.33.4](/java/docs/reference/google-api-client/1.33.4/com.google.api.client.googleapis.notifications) \n[com.google.api.client.util.Beta](https://cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.Beta.html) \n\nSupport for notification channels to listen for changes to watched Google API resources.\n\nClasses\n-------\n\n### [AbstractNotification](/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.notifications.AbstractNotification)\n\nBeta \n\nNotification metadata sent to this client about a watched resource.\n\nImplementation is not thread-safe.\n\n### [NotificationUtils](/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.notifications.NotificationUtils)\n\nUtilities for notifications and notification channels.\n\n### [ResourceStates](/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.notifications.ResourceStates)\n\nBeta \n\nStandard resource states used by notifications.\n\n### [StoredChannel](/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.notifications.StoredChannel)\n\nBeta \n\nNotification channel information to be stored in a data store.\n\nImplementation is thread safe.\n\n### [TypedNotification\\\u003cT\\\u003e](/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.notifications.TypedNotification)\n\nBeta \n\nNotification metadata and parsed content sent to this client about a watched resource.\n\nImplementation is not thread-safe.\n\n### [TypedNotificationCallback\\\u003cT\\\u003e](/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.notifications.TypedNotificationCallback)\n\nBeta \n\nCallback to receive notifications for watched resource in which the . Callback which is used to\nreceive typed [AbstractNotification](/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.notifications.AbstractNotification)s after subscribing to a topic.\n\nMust NOT be implemented in form of an anonymous class as this will break serialization.\n\nImplementation should be thread-safe. **Example usage:** \n\n\n static class MyNotificationCallback\n extends JsonNotificationCallback{@literal \u003c}listresponse{@literal\u003e} {\n\n private static final long serialVersionUID = 1L;\n\n {@literal @}Override\n protected void onNotification\n (StoredChannel subscription, Notification notification, ListResponse content) {\n switch (notification.getResourceState()) {\n case ResourceStates.SYNC:\n break;\n case ResourceStates.EXISTS:\n break;\n case ResourceStates.NOT_EXISTS:\n break;\n }\n }\n\n {@literal @}Override\n protected ObjectParser getObjectParser(Notification notification) throws IOException {\n return new JsonObjectParser(new GsonFactory());\n }\n\n {@literal @}Override\n protected Class{@literal \u003c}listresponse{@literal\u003e} getDataClass() throws IOException {\n return ListResponse.class;\n }\n }\n \n### [UnparsedNotification](/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.notifications.UnparsedNotification)\n\nBeta \n\nNotification metadata and unparsed content stream sent to this client about a watched resource.\n\nImplementation is not thread-safe.\n\nInterfaces\n----------\n\n### [UnparsedNotificationCallback](/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.notifications.UnparsedNotificationCallback)\n\nBeta \n\nCallback to receive unparsed notifications for watched resource.\n\nMust NOT be implemented in form of an anonymous class since this would break serialization.\n\nShould be thread-safe as several notifications might be processed at the same time. **Example\nusage:** \n\n\n static class MyNotificationCallback implements UnparsedNotificationCallback {\n\n private static final long serialVersionUID = 1L;\n\n {@literal @}Override\n public void onNotification(StoredChannel storedChannel, UnparsedNotification notification) {\n String contentType = notification.getContentType();\n InputStream contentStream = notification.getContentStream();\n switch (notification.getResourceState()) {\n case ResourceStates.SYNC:\n break;\n case ResourceStates.EXISTS:\n break;\n case ResourceStates.NOT_EXISTS:\n break;\n }\n }\n }"]]