Android Guides | Samples

Android.Media.MediaScannerConnection Class

MediaScannerConnection provides a way for applications to pass a newly created or downloaded media file to the media scanner service.

See Also: MediaScannerConnection

Syntax

[Android.Runtime.Register("android/media/MediaScannerConnection", DoNotGenerateAcw=true)]
public class MediaScannerConnection : Object, IServiceConnection, IDisposable

Remarks

MediaScannerConnection provides a way for applications to pass a newly created or downloaded media file to the media scanner service. The media scanner service will read metadata from the file and add the file to the media content provider. The MediaScannerConnectionClient provides an interface for the media scanner service to return the Uri for a newly scanned file to the client of the MediaScannerConnection class.

[Android Documentation]

Requirements

Namespace: Android.Media
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Android.Media.MediaScannerConnection are listed below.

See Also: Object

Public Constructors

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Public Properties

[read-only]
IsConnectedBoolean. Returns whether we are connected to the media scanner service

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

Connect()
Initiates a connection to the media scanner service.
Disconnect()
Releases the connection to the media scanner service.
OnServiceConnected(ComponentName, IBinder)
Part of the ServiceConnection interface.
OnServiceDisconnected(ComponentName)
Part of the ServiceConnection interface.
ScanFile(String, String)
Requests the media scanner to scan a file.
static
ScanFile(Context, String[], String[], MediaScannerConnection+IOnScanCompletedListener)
Convenience for constructing a MediaScannerConnection, calling MediaScannerConnection.Connect on it, and calling MediaScannerConnection.ScanFile(Context,String[],String[],String[]) with the given path and mimeType when the connection is established.