×
Namespaces

Variants
Actions

Playing a message with the native message reader on Symbian

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Tested with
Devices(s): Nokia E90 Communicator
Compatibility
Platform(s): S60 3rd Edition, FP1
Article
Keywords: AIW, TTS, messaging
Created: User:Technical writer 1 (02 Oct 2008)
Last edited: hamishwillee (14 Jun 2012)

Contents

Overview

With AIW you can easily tell the preinstalled native message reader application to read any message stored in your messaging folders.

This snippet can be self-signed.

Preconditions (optional)

This API works only in devices that have a preinstalled native message reader application.

MMP file

The following library is required:

LIBRARY servicehandler.lib

0

In the resource file

Add the following headers:

 #include <AiwCommon.hrh>
#include <AiwCommon.rh>

Next, in the MENU_PANE resource, define a menu item as follows:

 MENU_ITEM
{
command = EAIWPlaceHolder1;
txt = "";
}

And define the AIW menu interest item as follows:

 RESOURCE AIW_INTEREST R_AIWTEST_MSG
{
items =
{
AIW_CRITERIA_ITEM
{
id = EAIWPlaceHolder1;
serviceCmd = KAiwCmdView; //from aiwcommon.hrh
serviceClass = KAiwClassMenu; //from aiwcommon.hrh
contentType = "message/*";
}
};
}


Source file

Add the following header

 #include <AiwServiceHandler.h>

Construct the CAiwServiceHandler and attach the menu interest to it. Note that the code assumes that the iEntry is member variable of the class, its type is TMsvEntry, and it is for a valid message.

 iServiceHandler = CAiwServiceHandler::NewL();
iServiceHandler->AttachMenuL(R_AIWTEST_MENU, R_AIWTEST_MSG);

Then add the actual menu item into the menu when it is shown:

 void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane *aMenuPane )
{
 
if(aResourceId == R_AIWTEST_MENU)
{
CAiwGenericParamList* params = CAiwGenericParamList::NewLC();
 
TPckgC<TMsvEntry> packedEntry(iEntry);
TAiwGenericParam mailParam( EGenericParamMessageItem);
mailParam.Value().Set(packedEntry);
params->AppendL( mailParam );
 
// Let AIW provider add its menu items to the menu.
iServiceHandler->InitializeMenuPaneL(
*aMenuPane,
aResourceId,
EAIWExampleCmdLast,
*params);
 
}
}

To play the message, the user selects the added menu item. You can handle it as follows in the command handlers default block:

 CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC();
 
TPckgC<TMsvEntry> packedEntry(iEntry);
TAiwGenericParam mailParam( EGenericParamMessageItem);
mailParam.Value().Set(packedEntry);
paramList->AppendL( mailParam );
 
iServiceHandler->ExecuteMenuCmdL(
aCommand,
*paramList,
iServiceHandler->OutParamListL(),
0,
this);
 
CleanupStack::PopAndDestroy(paramList);

Postconditions

The selected message should now be played with the native message reader.

This page was last modified on 14 June 2012, at 01:03.
53 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.

×