Megosztás a következőn keresztül:


Context.RegisterDeviceIdChangeListener(IExecutor, IIntConsumer) Method

Definition

Adds a new device ID changed listener to the Context, which will be called when the device association is changed by the system.

[Android.Runtime.Register("registerDeviceIdChangeListener", "(Ljava/util/concurrent/Executor;Ljava/util/function/IntConsumer;)V", "GetRegisterDeviceIdChangeListener_Ljava_util_concurrent_Executor_Ljava_util_function_IntConsumer_Handler", ApiSince=34)]
public virtual void RegisterDeviceIdChangeListener (Java.Util.Concurrent.IExecutor executor, Java.Util.Functions.IIntConsumer listener);
[<Android.Runtime.Register("registerDeviceIdChangeListener", "(Ljava/util/concurrent/Executor;Ljava/util/function/IntConsumer;)V", "GetRegisterDeviceIdChangeListener_Ljava_util_concurrent_Executor_Ljava_util_function_IntConsumer_Handler", ApiSince=34)>]
abstract member RegisterDeviceIdChangeListener : Java.Util.Concurrent.IExecutor * Java.Util.Functions.IIntConsumer -> unit
override this.RegisterDeviceIdChangeListener : Java.Util.Concurrent.IExecutor * Java.Util.Functions.IIntConsumer -> unit

Parameters

executor
IExecutor

The Executor on whose thread to execute the callbacks of the listener object.

listener
IIntConsumer

The listener IntConsumer to call which will receive the updated device ID.

Attributes

Remarks

Adds a new device ID changed listener to the Context, which will be called when the device association is changed by the system.

The callback can be called when an app is moved to a different device and the Context is not explicitly associated with a specific device.

When an application receives a device id update callback, this Context is guaranteed to also have an updated display ID(if any) and Configuration. <p/>

Java documentation for android.content.Context.registerDeviceIdChangeListener(java.util.concurrent.Executor, java.util.function.IntConsumer).

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.

Applies to