DataApi.DataListener
Stay organized with collections
Save and categorize content based on your preferences.
Known Indirect Subclasses
Public Methods
public abstract void
onDataChanged
( DataEventBuffer
dataEvents)
Notification that a set of data items have been changed or deleted. The data buffer
is released upon completion of this method. If a caller wishes to use the events
outside this callback, they should be sure to freeze
the DataEvent
objects they wish to use.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eDataApi.DataListener\u003c/code\u003e is deprecated; use \u003ccode\u003eDataClient.OnDataChangedListener\u003c/code\u003e instead.\u003c/p\u003e\n"],["\u003cp\u003eIt was used to receive data events in wearables, triggered by changes or deletions.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eonDataChanged()\u003c/code\u003e is the key method, providing a buffer of \u003ccode\u003eDataEvent\u003c/code\u003e objects reflecting the changes.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eWearableListenerService\u003c/code\u003e can also be used to handle similar data and connectivity events.\u003c/p\u003e\n"]]],["`DataApi.DataListener` is a deprecated interface for receiving data events. Instead, `DataClient.OnDataChangedListener` should be used. `DataApi.DataListener` uses `onDataChanged` method that triggers when data items change or are deleted. This method receives a `DataEventBuffer`, which must be processed before it is released. If the data is used outside of `onDataChanged`, the `DataEvent` objects need to be frozen.\n"],null,["# DataApi.DataListener\n\npublic static interface **DataApi.DataListener** \n\n|---|---|---|\n| Known Indirect Subclasses [DataClient.OnDataChangedListener](/android/reference/com/google/android/gms/wearable/DataClient.OnDataChangedListener), [WearableListenerService](/android/reference/com/google/android/gms/wearable/WearableListenerService) |-------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [DataClient.OnDataChangedListener](/android/reference/com/google/android/gms/wearable/DataClient.OnDataChangedListener) | Used with [DataClient.addListener(DataClient.OnDataChangedListener)](/android/reference/com/google/android/gms/wearable/DataClient#addListener(com.google.android.gms.wearable.DataClient.OnDataChangedListener)) to receive data events. | | [WearableListenerService](/android/reference/com/google/android/gms/wearable/WearableListenerService) | Receives events from other nodes, such as data changes, messages or connectivity events. | |||\n\n**This interface is deprecated.** \n\nUse [DataClient.OnDataChangedListener](/android/reference/com/google/android/gms/wearable/DataClient.OnDataChangedListener).\n\nUsed with [DataApi.addListener(GoogleApiClient, DataApi.DataListener)](/android/reference/com/google/android/gms/wearable/DataApi#addListener(com.google.android.gms.common.api.GoogleApiClient,%20com.google.android.gms.wearable.DataApi.DataListener)) to receive data\nevents. \n\n##### See Also\n\n- [WearableListenerService](/android/reference/com/google/android/gms/wearable/WearableListenerService) \n\n### Public Method Summary\n\n|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract void | [onDataChanged](/android/reference/com/google/android/gms/wearable/DataApi.DataListener#onDataChanged(com.google.android.gms.wearable.DataEventBuffer))([DataEventBuffer](/android/reference/com/google/android/gms/wearable/DataEventBuffer) dataEvents) Notification that a set of data items have been changed or deleted. |\n\nPublic Methods\n--------------\n\n#### public abstract void **onDataChanged** ([DataEventBuffer](/android/reference/com/google/android/gms/wearable/DataEventBuffer) dataEvents)\n\nNotification that a set of data items have been changed or deleted. The data buffer\nis released upon completion of this method. If a caller wishes to use the events\noutside this callback, they should be sure to [freeze](/android/reference/com/google/android/gms/common/data/Freezable#freeze())\nthe [DataEvent](/android/reference/com/google/android/gms/wearable/DataEvent)\nobjects they wish to use."]]