DriveEvent
Stay organized with collections
Save and categorize content based on your preferences.
Known Indirect Subclasses
|
Base interface implemented by all Drive event types. An application can express interest
in receiving events by adding an event listener or declaring an event listener service.
An event listener implements the listener interface for a particular event type and
receives a direct callback from the Drive service to the client application that is currently
connected. A listener is added by calling the appropriate
add<EventType>Listener
method on the DriveResource
of interest. Listeners are active for the duration of the current connection or until the
remove<EventType>Listener
method is called on the same entity with the
same callback parameter.
An event service must be declared in an application's manifest to indicate that an
application is interested in receiving events via bound service AIDL calls on the event
service, even if the application is not currently connected or even running.
A subscription is added by calling the appropriate
add<EventType>Subscription
method on the DriveResource
of interest. Subscriptions are active until the
remove<EventType>Subscription
method is called on the same entity or until
the next device reboot. An application that is interested in maintaining any subscriptions
across reboots should handle the ACTION_BOOT_COMPLETED
intent to add back these subscriptions after the reboot has completed.
Some event types will also support the ability to request event delivery using the
ExecutionOptions
parameter that is passed to a Drive API call. This will indicate that the requested events be
delivered to the event service for as long as the operation is active, i.e. until it has
successfully completed or permanently failed.
Events will be delivered to all registered listeners, subscribers, and/or enabled
operations that match the event. The same event may be delivered to more than one listener or
service when appropriate.
Inherited Constant Summary
From interface android.os.Parcelable
int |
CONTENTS_FILE_DESCRIPTOR |
|
int |
PARCELABLE_WRITE_RETURN_VALUE |
|
Inherited Method Summary
From interface android.os.Parcelable
abstract int |
describeContents()
|
abstract void |
writeToParcel( Parcel arg0,
int arg1)
|
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.
[null,null,["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eDriveEvent\u003c/code\u003e is the base interface for all Drive event types, allowing applications to receive notifications about changes in Google Drive.\u003c/p\u003e\n"],["\u003cp\u003eApplications can receive Drive events using event listeners for immediate in-app notifications or event services for background processing.\u003c/p\u003e\n"],["\u003cp\u003eEvent subscriptions persist across app sessions, but require re-subscription after device reboots using the \u003ccode\u003eACTION_BOOT_COMPLETED\u003c/code\u003e intent.\u003c/p\u003e\n"],["\u003cp\u003eSome Drive API operations can be configured to deliver events to the event service for the duration of their execution.\u003c/p\u003e\n"],["\u003cp\u003eEvents are delivered to all registered listeners, subscribers, and relevant operations matching the event criteria.\u003c/p\u003e\n"]]],["`DriveEvent` is the base interface for all Drive events, enabling applications to receive notifications about changes. Events are delivered via listeners or services. Listeners receive direct callbacks when connected, added via `add\u003cEventType\u003eListener`, and active until removed via `remove\u003cEventType\u003eListener`. Services receive events via AIDL calls, declared in the app's manifest and added via `add\u003cEventType\u003eSubscription`. Subscriptions persist until removed via `remove\u003cEventType\u003eSubscription` or reboot, requiring re-establishment post-reboot. Events can also be delivered for active operations via `ExecutionOptions`.\n"],null,["# DriveEvent\n\npublic interface **DriveEvent** implements [Parcelable](//developer.android.com/reference/android/os/Parcelable.html) \n\n|---|---|---|\n| Known Indirect Subclasses [ChangeEvent](/android/reference/com/google/android/gms/drive/events/ChangeEvent), [CompletionEvent](/android/reference/com/google/android/gms/drive/events/CompletionEvent), [ResourceEvent](/android/reference/com/google/android/gms/drive/events/ResourceEvent) |-------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [ChangeEvent](/android/reference/com/google/android/gms/drive/events/ChangeEvent) | Sent when a [DriveResource](/android/reference/com/google/android/gms/drive/DriveResource) has had a change to its [DriveContents](/android/reference/com/google/android/gms/drive/DriveContents) or [Metadata](/android/reference/com/google/android/gms/drive/Metadata). | | [CompletionEvent](/android/reference/com/google/android/gms/drive/events/CompletionEvent) | An event delivered after the client requests a completion notification using [setNotifyOnCompletion(boolean)](/android/reference/com/google/android/gms/drive/ExecutionOptions.Builder#setNotifyOnCompletion(boolean)) and that action has either succeeded or failed on the server. | | [ResourceEvent](/android/reference/com/google/android/gms/drive/events/ResourceEvent) | Base interface for [DriveEvent](/android/reference/com/google/android/gms/drive/events/DriveEvent) types related to a specific resource. | |||\n\nBase interface implemented by all Drive event types. An application can express interest\nin receiving events by adding an event listener or declaring an event listener service.\n\nAn event listener implements the listener interface for a particular event type and\nreceives a direct callback from the Drive service to the client application that is currently\nconnected. A listener is added by calling the appropriate\n`add\u003cEventType\u003eListener` method on the [DriveResource](/android/reference/com/google/android/gms/drive/DriveResource)\nof interest. Listeners are active for the duration of the current connection or until the\n`remove\u003cEventType\u003eListener` method is called on the same entity with the\nsame callback parameter.\n\nAn event service must be declared in an application's manifest to indicate that an\napplication is interested in receiving events via bound service AIDL calls on the event\nservice, even if the application is not currently connected or even running.\n\nA subscription is added by calling the appropriate\n`add\u003cEventType\u003eSubscription` method on the [DriveResource](/android/reference/com/google/android/gms/drive/DriveResource)\nof interest. Subscriptions are active until the\n`remove\u003cEventType\u003eSubscription` method is called on the same entity or until\nthe next device reboot. An application that is interested in maintaining any subscriptions\nacross reboots should handle the [ACTION_BOOT_COMPLETED](//developer.android.com/reference/android/content/Intent.html#ACTION_BOOT_COMPLETED)\nintent to add back these subscriptions after the reboot has completed.\n\nSome event types will also support the ability to request event delivery using the\n[ExecutionOptions](/android/reference/com/google/android/gms/drive/ExecutionOptions)\nparameter that is passed to a Drive API call. This will indicate that the requested events be\ndelivered to the event service for as long as the operation is active, i.e. until it has\nsuccessfully completed or permanently failed.\n\nEvents will be delivered to all registered listeners, subscribers, and/or enabled\noperations that match the event. The same event may be delivered to more than one listener or\nservice when appropriate. \n\n### Inherited Constant Summary\n\nFrom interface android.os.Parcelable \n\n|-----|-------------------------------|---|\n| int | CONTENTS_FILE_DESCRIPTOR | |\n| int | PARCELABLE_WRITE_RETURN_VALUE | |\n\n### Inherited Method Summary\n\nFrom interface android.os.Parcelable \n\n|---------------|--------------------------------------------------------------------------------------------------|\n| abstract int | describeContents() |\n| abstract void | writeToParcel([Parcel](//developer.android.com/reference/android/os/Parcel.html) arg0, int arg1) |"]]