次の方法で共有


CompanionDeviceService.AttachSystemDataTransport Method

Definition

Attach the given bidirectional communication streams to be used for transporting system data between associated devices.

[Android.Runtime.Register("attachSystemDataTransport", "(ILjava/io/InputStream;Ljava/io/OutputStream;)V", "", ApiSince=34)]
[Android.Runtime.RequiresPermission("android.permission.DELIVER_COMPANION_MESSAGES")]
public void AttachSystemDataTransport (int associationId, System.IO.Stream in, System.IO.Stream out);
[<Android.Runtime.Register("attachSystemDataTransport", "(ILjava/io/InputStream;Ljava/io/OutputStream;)V", "", ApiSince=34)>]
[<Android.Runtime.RequiresPermission("android.permission.DELIVER_COMPANION_MESSAGES")>]
member this.AttachSystemDataTransport : int * System.IO.Stream * System.IO.Stream -> unit

Parameters

associationId
Int32

id of the associated device

in
Stream

already connected stream of data incoming from remote associated device

out
Stream

already connected stream of data outgoing to remote associated device

Attributes

Remarks

Attach the given bidirectional communication streams to be used for transporting system data between associated devices.

The companion service providing these streams is responsible for ensuring that all data is transported accurately and in-order between the two devices, including any fragmentation and re-assembly when carried over a size-limited transport.

As an example, it's valid to provide streams obtained from a BluetoothSocket to this method, since BluetoothSocket meets the API contract described above.

This method passes through to CompanionDeviceManager#attachSystemDataTransport(int, InputStream, OutputStream) for your convenience if you get callbacks in this class.

Java documentation for android.companion.CompanionDeviceService.attachSystemDataTransport(int, java.io.InputStream, java.io.OutputStream).

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