다음을 통해 공유


RemoteCallbackList Class

Definition

Takes care of the grunt work of maintaining a list of remote interfaces, typically for the use of performing callbacks from a android.app.Service to its clients.

[Android.Runtime.Register("android/os/RemoteCallbackList", DoNotGenerateAcw=true)]
[Java.Interop.JavaTypeParameters(new System.String[] { "E extends android.os.IInterface" })]
public class RemoteCallbackList : Java.Lang.Object
[<Android.Runtime.Register("android/os/RemoteCallbackList", DoNotGenerateAcw=true)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "E extends android.os.IInterface" })>]
type RemoteCallbackList = class
    inherit Object
Inheritance
RemoteCallbackList
Attributes

Remarks

Takes care of the grunt work of maintaining a list of remote interfaces, typically for the use of performing callbacks from a android.app.Service to its clients. In particular, this:

<ul> <li> Keeps track of a set of registered IInterface callbacks, taking care to identify them through their underlying unique IBinder (by calling IInterface#asBinder IInterface.asBinder(). <li> Attaches a IBinder.DeathRecipient IBinder.DeathRecipient to each registered interface, so that it can be cleaned out of the list if its process goes away. <li> Performs locking of the underlying list of interfaces to deal with multithreaded incoming calls, and a thread-safe way to iterate over a snapshot of the list without holding its lock. </ul>

To use this class, simply create a single instance along with your service, and call its #register and #unregister methods as client register and unregister with your service. To call back on to the registered clients, use #beginBroadcast, #getBroadcastItem, and #finishBroadcast.

If a registered callback's process goes away, this class will take care of automatically removing it from the list. If you want to do additional work in this situation, you can create a subclass that implements the #onCallbackDied method.

Java documentation for android.os.RemoteCallbackList.

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.

Constructors

RemoteCallbackList()
RemoteCallbackList(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
RegisteredCallbackCount

Returns the number of registered callbacks.

ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Methods

BeginBroadcast()

Prepare to start making calls to the currently registered callbacks.

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
FinishBroadcast()

Clean up the state of a broadcast previously initiated by calling #beginBroadcast.

GetBroadcastCookie(Int32)

Retrieve the cookie associated with the item returned by #getBroadcastItem(int).

GetBroadcastItem(Int32)

Retrieve an item in the active broadcast that was previously started with #beginBroadcast.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetRegisteredCallbackCookie(Int32)

Return any cookie associated with a currently registered callback.

GetRegisteredCallbackItem(Int32)

Return a currently registered callback.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Kill()

Disable this callback list.

Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
OnCallbackDied(Object, Object)

Called when the process hosting a callback in the list has gone away.

OnCallbackDied(Object)

Old version of #onCallbackDied(E, Object) that does not provide a cookie.

Register(Object, Object)

Add a new callback to the list.

Register(Object)

Simple version of RemoteCallbackList#register(E, Object) that does not take a cookie object.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
Unregister(Object)

Remove from the list a callback that was previously added with #register.

UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to