Language

MtpDevice.ImportFileAsync Method

Definition

Overloads

ImportFileAsync(Int32, ParcelFileDescriptor)

Runs ImportFile(Int32, ParcelFileDescriptor) on a thread-pool thread.

public System.Threading.Tasks.Task<bool> ImportFileAsync(int objectHandle, Android.OS.ParcelFileDescriptor descriptor);
member this.ImportFileAsync : int * Android.OS.ParcelFileDescriptor -> System.Threading.Tasks.Task<bool>

Parameters

objectHandle
Int32

The handle of the object to read from the device.

descriptor
ParcelFileDescriptor

The destination file descriptor. Keep it open until the task completes, then close it when it is no longer needed. This operation does not close it.

Returns

A task whose result is the Boolean returned by ImportFile(Int32, ParcelFileDescriptor). A result of true does not confirm that all destination writes succeeded. A failed or short write can leave an incomplete file even when the result is true.

Remarks

This limitation is verified in MtpDevice.cpp in Android 16 (android-16.0.0_r1): readData records destination write errors but returns whether the MTP response is OK.

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

ImportFileAsync(Int32, String)

Runs ImportFile(Int32, String) on a thread-pool thread.

public System.Threading.Tasks.Task<bool> ImportFileAsync(int objectHandle, string destPath);
member this.ImportFileAsync : int * string -> System.Threading.Tasks.Task<bool>

Parameters

objectHandle
Int32

The handle of the object to read from the device.

destPath
String

The destination file path in external storage.

Returns

A task whose result is the Boolean returned by ImportFile(Int32, String). A result of true does not confirm that all destination writes succeeded. A failed or short write can leave an incomplete file even when the result is true.

Remarks

This limitation is verified in MtpDevice.cpp in Android 16 (android-16.0.0_r1): readData records destination write errors but returns whether the MTP response is OK.

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