×
Namespaces

Variants
Actions
(Difference between revisions)

Archived:Media File Symbian API

From Nokia Developer Wiki
Jump to: navigation, search
Forum Nokia KB (Talk | contribs)
lpvalente (Talk | contribs)
m (Lpvalente -)
 
(13 intermediate revisions by 6 users not shown)
Line 1: Line 1:
[[Category:Symbian C++]][[Category:S60 3rd Edition, Feature Pack 2 ]][[Category:Published]][[Category:Media]][[Category:Code Examples]]
+
[[Category:Symbian C++]][[Category:S60 3rd Edition FP2]][[Category:Media]][[Category:Code Examples]][[Category:Code Snippet]]
__NOTOC__
+
{{Archived|timestamp=20120313122044|user=roy.debjit| }}
__NOEDITSECTION__
+
{{ArticleMetaData <!-- v1.2 -->
{{KBCS}}
+
|sourcecode= [[Media:MediaFileEx.zip]]
{|style="background:#eceff2" width="660px" border="1" cellpadding="5" cellspacing="0"
+
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
|-
+
|devices= <!-- Devices tested against - e.g. ''devices=Nokia 6131 NFC, Nokia C7-00'') -->
|'''ID''' ||CS001036
+
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
|'''Creation date''' || June 13, 2008
+
|platform= S60 3rd Edition, FP2
|-
+
|devicecompatability= <!-- Compatible devices (e.g.: All* (must have GPS) ) -->
|'''Platform''' ||S60 3rd Edition, FP2
+
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
|'''Tested on devices''' || &nbsp;
+
|signing= <!-- Empty or one of Self-Signed, DevCert, Manufacturer -->
|-
+
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
|'''Category''' ||S60 3rd Edition, FP2
+
|keywords= Media File API
|'''Subcategory''' || Media
+
|language= <!-- Language category code for non-English topics - e.g. Lang-Chinese -->
|-
+
|translated-by= <!-- [[User:XXXX]] -->
|}
+
|translated-from-title= <!-- Title only -->
 +
|translated-from-id= <!-- Id of translated revision -->
 +
|review-by= <!-- After re-review: [[User:username]] -->
 +
|review-timestamp= <!-- After re-review: YYYYMMDD -->
 +
|update-by= <!-- After significant update: [[User:username]]-->
 +
|update-timestamp= <!-- After significant update: YYYYMMDD -->
 +
|creationdate= 20080612
 +
|author= [[User:Technical writer 1]]
 +
<!-- The following are not in current metadata -->
 +
|subcategory= Media
 +
|id= CS001036
 +
}}
  
  
{|style="background:#eceff2" width="660px" border="1" cellpadding="5" cellspacing="0"
+
{{Note|
|-
+
|'''Keywords (APIs, classes, methods, functions):''' Media File API
+
|}
+
 
+
 
+
{{NoteS}}
+
 
:This API is not part of the public SDK. It can be found in the [[SDK API Plug-in]].  
 
:This API is not part of the public SDK. It can be found in the [[SDK API Plug-in]].  
{{NoteE}}
+
}}
 
+
 
The Media File API is responsible for sending notifications about file updates to the Media Gallery. It also offers an API to check duplicate media files, that is, to check if the file name is a unique media file name in the phone memory or the multimedia card.
+
{{Abstract|The Media File API is responsible for sending notifications about file updates to the Media Gallery. It also offers an API to check duplicate media files, that is, to check if the file name is a unique media file name in the phone memory or the multimedia card.}}
  
 
==Header files==
 
==Header files==
Line 39: Line 44:
  
 
<code cpp>
 
<code cpp>
  LIBRARY   MGXMediafileapi.lib
+
  LIBRARY MGXMediafileapi.lib
 
</code>
 
</code>
  
 
==Required capability==
 
==Required capability==
 
<code cpp>
 
<code cpp>
  CAPABILITY ReadUserData WriteDeviceData
+
  CAPABILITY ReadUserData WriteDeviceData
 
</code>
 
</code>
  
Line 94: Line 99:
 
  //To check for file in phone memory.
 
  //To check for file in phone memory.
 
  //iFileName is filename to be checked.
 
  //iFileName is filename to be checked.
  //To check if it exists in MMC use "EDriveE" instead of "EDriveC"
+
  //To check if it exists in MMC use "EDriveE" instead of "EDriveC"
 
</code>
 
</code>
  
Line 101: Line 106:
 
You can also register to get notifications of changed media files (for example, new files are created or existing files are modified or deleted, etc.)
 
You can also register to get notifications of changed media files (for example, new files are created or existing files are modified or deleted, etc.)
  
1) Derive your class from MMGXFileNotificationObserver and implement the pure virtual function <tt>HandleFileNotificationEventL</tt>.<br>
+
1) Derive your class from MMGXFileNotificationObserver and implement the pure virtual function {{Icode|HandleFileNotificationEventL}}.<br>
 
2) Register for observations:  
 
2) Register for observations:  
 
<code cpp>  
 
<code cpp>  
Line 112: Line 117:
  
 
==Example project==
 
==Example project==
[[Image:MediaFileEx.zip]]
+
[[File:MediaFileEx.zip]]

Latest revision as of 16:05, 23 January 2013

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

Article Metadata
Code ExampleCompatibility
Platform(s): S60 3rd Edition, FP2
S60 3rd Edition FP2
Article
Keywords: Media File API
Created: User:Technical writer 1 (12 Jun 2008)
Last edited: lpvalente (23 Jan 2013)


Note.pngNote: :This API is not part of the public SDK. It can be found in the SDK API Plug-in.

The Media File API is responsible for sending notifications about file updates to the Media Gallery. It also offers an API to check duplicate media files, that is, to check if the file name is a unique media file name in the phone memory or the multimedia card.

Contents

[edit] Header files

 #include <MGXFileManagerFactory.h>
 #include <CMGXFileManager.h>
 #include <CMGXFileNotificationHandler.h>
 #include <MMGXFileNotificationObserver.h>

[edit] Link against

 LIBRARY MGXMediafileapi.lib

[edit] Required capability

 CAPABILITY ReadUserData WriteDeviceData

[edit] Example code

Creating File Manager and the file notification handler

 CMGXFileManager* iFileManager = MGXFileManagerFactory::NewFileManagerL(
iCoeEnv->FsSession() );
CMGXFileNotificationHandler* iFNH =
MGXFileManagerFactory::NewFileNotificationHandlerL();

Updating a file

There are different file update types:
1) A general update to the media gallery.
2) Notify Media Gallery after saving a file from a viewer application.
3) Notify Media Gallery after renaming a media file.
4) Update Media Gallery files (an array of files).

The code snippet to send an update is:

 // Create an array of descriptors for the selected files
CDesCArrayFlat* fileArray = new (ELeave) CDesCArrayFlat(5);
CleanupStack::PushL(fileArray);
TBool allowMultiple(EFalse);
TBuf <20> lHeading;
lHeading.Append(_L("Image Files"));
// Open the dialog. this is overloaded
TBool ret = MGFetch::RunL(*fileArray,EImageFile,allowMultiple,KNullDesC,lHeading);
if( ret )
{
BaflUtils::RenameFile(CEikonEnv::Static()->FsSession(),
fileArray->MdcaPoint(0),_L("c:\\Data\\Images\\new.bmp"));
iContainer->SetTextL( _L("File Renamed") );
iFileManager->UpdateL(fileArray->MdcaPoint(0),_L("c:\\Data\\Images\\new.bmp"));
}
else
{
iContainer->SetTextL( _L("File Not Selected") );
}
CleanupStack::PopAndDestroy(); // fileArray

Checking for duplicate file names :

 TBool ret = iFileManager->SuccessFileNameL( iFileName, EDriveC );
//To check for file in phone memory.
//iFileName is filename to be checked.
//To check if it exists in MMC use "EDriveE" instead of "EDriveC"

Register and unregister observer

You can also register to get notifications of changed media files (for example, new files are created or existing files are modified or deleted, etc.)

1) Derive your class from MMGXFileNotificationObserver and implement the pure virtual function HandleFileNotificationEventL.
2) Register for observations:

 iFNH->SetObserver( *this )

3) Unregister to stop getting notifications :

 iFNH->RemoveObserver(*this);

[edit] Example project

File:MediaFileEx.zip

This page was last modified on 23 January 2013, at 16:05.
139 page views in the last 30 days.
×