Język

BackupDataOutput.WriteEntityHeaderAsync(String, Int32) Method

Definition

Runs WriteEntityHeader(String, Int32) on a thread pool thread.

public System.Threading.Tasks.Task<int> WriteEntityHeaderAsync(string? key, int dataSize);
member this.WriteEntityHeaderAsync : string * int -> System.Threading.Tasks.Task<int>

Parameters

key
String

The key that uniquely identifies the record in the application's backup data. The first character must be less than U+FF00.

dataSize
Int32

The size of the record data, in bytes; or -1 to delete the record with this key.

Returns

A task whose result is the status returned by WriteEntityHeader. The Android framework implementation returns zero on a successful write, not the number of bytes written.

Remarks

This .NET wrapper uses Task.Run to call the synchronous method. Await the task before writing the entity data or starting another operation on this output. Do not write entity data for a deletion record.

Do not use the result to calculate the number of bytes in the backup stream. The wrapper forwards the synchronous result without converting it. See the Android native writer implementation.

.NET task wrapper implementation.

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