Code example for MediaScannerConnection

Methods: isConnected, scanFile

0
	public void onMediaScannerConnected() { 
		// TODO Auto-generated method stub 
		String filePath = DownloadHelper.getDownloadPath();
		String fileName = mProcess.getDownloadEntry().getTitle();
		 
		if(mConnection.isConnected()){
			mScannedFilesInProgress++;
			mConnection.scanFile(filePath + "/" + fileName + ".mp3", null);
		} 
	} 
 
	@Override 
	public void onScanCompleted(String path, Uri uri) {
		// TODO Auto-generated method stub 
		mScannedFilesInProgress--;
		mConnection.disconnect();
		 
		if(mScannedFilesInProgress == 0){
			mService.notifyScanCompleted();
		}