Android Guides | Samples

Android.OS.Messenger Class

Reference to a Handler, which others can use to send messages to it.

See Also: Messenger

Syntax

[Android.Runtime.Register("android/os/Messenger", DoNotGenerateAcw=true)]
public sealed class Messenger : Object, IParcelable, IDisposable

Remarks

Reference to a Handler, which others can use to send messages to it. This allows for the implementation of message-based communication across processes, by creating a Messenger pointing to a Handler in one process, and handing that Messenger to another process.

Note: the implementation underneath is just a simple wrapper around a Binder that is used to perform the communication. This means semantically you should treat it as such: this class does not impact process lifecycle management (you must be using some higher-level component to tell the system that your process needs to continue running), the connection will break if your process goes away for any reason, etc.

[Android Documentation]

Requirements

Namespace: Android.OS
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Android.OS.Messenger are listed below.

See Also: Object

Public Constructors

Create a new Messenger pointing to the given Handler.
Create a Messenger from a raw IBinder, which had previously been retrieved with Messenger.Binder.

Public Properties

[read-only]
BinderIBinder. Retrieve the IBinder that this Messenger is using to communicate with its associated Handler.
[read-only]
static
CreatorIParcelableCreator.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

DescribeContents() : Int32
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
static
ReadMessengerOrNullFromParcel(Parcel) : Messenger
Convenience function for reading either a Messenger or null pointer from a Parcel.
Send(Message)
Send a Message to this Messenger's Handler.
static
WriteMessengerOrNullToParcel(Messenger, Parcel)
Convenience function for writing either a Messenger or null pointer to a Parcel.
WriteToParcel(Parcel, ParcelableWriteFlags)
Flatten this object in to a Parcel.