Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Change application MIME type mapping on Symbian

From Wiki
Jump to: navigation, search
Article Metadata
Tested with
Devices(s): Nokia 5800 XpressMusic
Compatibility
Platform(s): S60 3rd Edition
S60 5th Edition
Article
Keywords: RApaLsSession, TDataTypePriority, TDataType
Created: tepaa (29 Apr 2009)
Last edited: hamishwillee (05 Jul 2012)

Contents

Overview

This snippet demonstrates how to change your application data mapping. We set image/jpg and image/jpeg MIME-type data mapping to our own application by setting higher priority for these data types in our application than the built-in Picture Gallery application has.

After data type mapping is set, the application tries to open any JPG image that the user selects from the device's file manager.

The changing of data types can be done during runtime, there is no need to reboot the device.

This snippet needs Open Signed Online signing because of the required capabilities (see below).

MMP file

The following libraries and capabilities are required:

CAPABILITY WriteDeviceData ReadDeviceData
LIBRARY apgrfx.lib
LIBRARY apmime.lib


Header file

// Your application UID that data mapping will be changed
const TUid KUidYourApp = {0x12345678};

Source file

#include <apgcli.h> // RApaLsSession 
#include <apmstd.h> // TDatatype
 
void CYourClass::ChangeDataMappingL(TDataType datatype, TBool aEnable)
{
// Create session
RApaLsSession rapala;
TInt err = rapala.Connect();
CleanupClosePushL(rapala);
 
// Change data mapping
 
// Remove previous mapping...
rapala.DeleteDataMapping(datatype);
 
// ...and set the new one
if (aEnable)
{
User::LeaveIfError(rapala.InsertDataMapping(datatype,
TDataTypePriority(KDataTypePriorityHigh+1),KUidYourApp));
}
 
CleanupStack::PopAndDestroy(); // rapala
}


How to use

The following code enables image/jpg and image/jpeg MIME type data mapping in your application. After that, data mapping is disabled from the built-in Picture Gallery application.

_LIT8(KDataType1,"image/jpg");
_LIT8(KDataType2,"image/jpeg");
 
ChangeDataMappingL(TDataType(KDataType1),ETrue);
ChangeDataMappingL(TDataType(KDataType2),ETrue);


See also

* S60_Platform_Document_Handler_Example
* Archived:Data handler applications must implement CAknAppUi::OpenFileL (Known Issue)
* Symbian MIME recognizers and opening files for editing
* Opening a file using CDocumentHandler


Postconditions

The application tries to open any JPG image selected by the user because it has higher data type mapping that the built-in Picture Gallery application.

This page was last modified on 5 July 2012, at 08:36.
55 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×