GlobalSearchSession.RegisterObserverCallback Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Adds an ObserverCallback to monitor changes within the databases owned by targetPackageName if they match the given android.app.appsearch.observer.ObserverSpec.
[Android.Runtime.Register("registerObserverCallback", "(Ljava/lang/String;Landroid/app/appsearch/observer/ObserverSpec;Ljava/util/concurrent/Executor;Landroid/app/appsearch/observer/ObserverCallback;)V", "GetRegisterObserverCallback_Ljava_lang_String_Landroid_app_appsearch_observer_ObserverSpec_Ljava_util_concurrent_Executor_Landroid_app_appsearch_observer_ObserverCallback_Handler", ApiSince=33)]
public virtual void RegisterObserverCallback(string targetPackageName, Android.App.AppSearch.Observers.ObserverSpec spec, Java.Util.Concurrent.IExecutor executor, Android.App.AppSearch.Observers.IObserverCallback observer);
[<Android.Runtime.Register("registerObserverCallback", "(Ljava/lang/String;Landroid/app/appsearch/observer/ObserverSpec;Ljava/util/concurrent/Executor;Landroid/app/appsearch/observer/ObserverCallback;)V", "GetRegisterObserverCallback_Ljava_lang_String_Landroid_app_appsearch_observer_ObserverSpec_Ljava_util_concurrent_Executor_Landroid_app_appsearch_observer_ObserverCallback_Handler", ApiSince=33)>]
abstract member RegisterObserverCallback : string * Android.App.AppSearch.Observers.ObserverSpec * Java.Util.Concurrent.IExecutor * Android.App.AppSearch.Observers.IObserverCallback -> unit
override this.RegisterObserverCallback : string * Android.App.AppSearch.Observers.ObserverSpec * Java.Util.Concurrent.IExecutor * Android.App.AppSearch.Observers.IObserverCallback -> unit
Parameters
- targetPackageName
- String
Package whose changes to monitor
- spec
- ObserverSpec
Specification of what types of changes to listen for
- executor
- IExecutor
Executor on which to call the observer callback methods.
- observer
- IObserverCallback
Callback to trigger when a schema or document changes
- Attributes
Remarks
Adds an ObserverCallback to monitor changes within the databases owned by targetPackageName if they match the given android.app.appsearch.observer.ObserverSpec.
The observer callback is only triggered for data that changes after it is registered. No notification about existing data is sent as a result of registering an observer. To find out about existing data, you must use the GlobalSearchSession#search API.
If the data owned by targetPackageName is not visible to you, the registration call will succeed but no notifications will be dispatched. Notifications could start flowing later if targetPackageName changes its schema visibility settings.
If no package matching targetPackageName exists on the system, the registration call will succeed but no notifications will be dispatched. Notifications could start flowing later if targetPackageName is installed and starts indexing data.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.