Sdílet prostřednictvím


MtpDevice Class

Definition

This class represents an MTP or PTP device connected on the USB host bus.

[Android.Runtime.Register("android/mtp/MtpDevice", DoNotGenerateAcw=true)]
public sealed class MtpDevice : Java.Lang.Object
[<Android.Runtime.Register("android/mtp/MtpDevice", DoNotGenerateAcw=true)>]
type MtpDevice = class
    inherit Object
Inheritance
MtpDevice
Attributes

Remarks

This class represents an MTP or PTP device connected on the USB host bus. An application can instantiate an object of this type, by referencing an attached android.hardware.usb.UsbDevice and then use methods in this class to get information about the device and objects stored on it, as well as open the connection and transfer data.

Java documentation for android.mtp.MtpDevice.

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.

Constructors

MtpDevice(UsbDevice)

MtpClient constructor

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
DeviceId

Returns the USB ID of the USB device.

DeviceInfo

Returns the MtpDeviceInfo for this device

DeviceName

Returns the name of the USB device This returns the same value as android.hardware.usb.UsbDevice#getDeviceName for the device's android.hardware.usb.UsbDevice

Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)
ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Close()

Closes all resources related to the MtpDevice object.

DeleteObject(Int32)

Deletes an object on the device.

DeleteObjectAsync(Int32)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetObject(Int32, Int32)

Returns the data for an object as a byte array.

GetObjectAsync(Int32, Int32)
GetObjectHandles(Int32, MtpFormat, Int32)

Returns the list of object handles for all objects on the given storage unit, with the given format and parent.

GetObjectInfo(Int32)

Retrieves the MtpObjectInfo for an object.

GetParent(Int32)

Retrieves the object handle for the parent of an object on the device.

GetPartialObject(Int32, Int64, Int64, Byte[])

Obtains object bytes in the specified range and writes it to an array.

GetPartialObject64(Int32, Int64, Int64, Byte[])

Obtains object bytes in the specified range and writes it to an array.

GetStorageId(Int32)

Retrieves the ID of the storage unit containing the given object on the device.

GetStorageIds()

Returns the list of IDs for all storage units on this device Information about each storage unit can be accessed via #getStorageInfo.

GetStorageInfo(Int32)

Retrieves the MtpStorageInfo for a storage unit.

GetThumbnail(Int32)

Returns the thumbnail data for an object as a byte array.

GetThumbnailAsync(Int32)
ImportFile(Int32, ParcelFileDescriptor)

Copies the data for an object to a file descriptor.

ImportFile(Int32, String)

Copies the data for an object to a file in external storage.

ImportFileAsync(Int32, ParcelFileDescriptor)
ImportFileAsync(Int32, String)
JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
Open(UsbDeviceConnection)

Opens the MTP device.

ReadEvent(CancellationSignal)

Reads an event from the device.

SendObject(Int32, Int64, ParcelFileDescriptor)

Copies the data for an object from a file descriptor.

SendObjectInfo(MtpObjectInfo)

Uploads an object metadata for a new entry.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to