Flow.IPublisher.Subscribe(Flow+ISubscriber) Method

Definition

Adds the given Subscriber if possible.

[Android.Runtime.Register("subscribe", "(Ljava/util/concurrent/Flow$Subscriber;)V", "GetSubscribe_Ljava_util_concurrent_Flow_Subscriber_Handler:Java.Util.Concurrent.Flow/IPublisherInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=30)]
public void Subscribe(Java.Util.Concurrent.Flow.ISubscriber? subscriber);
[<Android.Runtime.Register("subscribe", "(Ljava/util/concurrent/Flow$Subscriber;)V", "GetSubscribe_Ljava_util_concurrent_Flow_Subscriber_Handler:Java.Util.Concurrent.Flow/IPublisherInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=30)>]
abstract member Subscribe : Java.Util.Concurrent.Flow.ISubscriber -> unit

Parameters

subscriber
Flow.ISubscriber

the subscriber

Attributes

Exceptions

if subscriber is null

Remarks

Adds the given Subscriber if possible. If the subscriber is already subscribed, or if the attempt fails because of policy violations or errors, its OnError method is invoked with an IllegalStateException.

Otherwise, the subscriber's OnSubscribe method is invoked with a new Subscription. The subscriber can receive items by invoking Request on that subscription and unsubscribe by invoking Cancel.

Java documentation for java.util.concurrent.Flow.Publisher.subscribe(java.util.concurrent.Flow.Subscriber).

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