|
A Multimedia Messaging Service (MMS) API has been made public for the new Sony Ericsson P910 smartphone series. This enables third-party developers to write applications that make use of MMS. (Note that P910 PDA SW version R2A017 or later is needed on the phone.) This MMS API is aligned with Nokia Series 60. An MMS application developed for Series 60 can easily be used on UIQ and vice versa. This simplifies the porting situation for developers.
This code sample shows how to use the supplied MMS API as an extension to the UIQ 2.1 SDK. Download the add-on module>>
The following zip file contains an example application that creates MMS messages:
Download code sample>>
To use the example application, in the file "mmsapiexample.cpp", the line:
iRecipient->Des().Append(_L(Your tel number));
should be changed to use a real telephone number.
The handset application is built using the following commands:
$ bldmake bldfiles $ abld build thumb urel $ makesis MmsApiExample.pkg
When "Send" is chosen in the application, a new MMS message appears in the out-box. Accessing the MMS client MTM Before using any of the features provided by the MMS client Message Type Module (MTM), it's necessary to obtain a handle to it. This is shown in the following example code:
iSession = CMsvSession::OpenSyncL(*this); iMtmReg = CClientMtmRegistry::NewL(*iSession); iMmsMtm = (CMmsClientMtm*) iMtmReg->NewMtmL( KUidMsgTypeMMS );
Sending an MMS message The sequence to create and send an MMS message with the API is as follows:
- Set context to the Draft folder
- Create the message and retrieve its TMsvId
- Set message parameters
- Add attachments and set their content IDs
- Set the message root (indicate which attachment is the SMIL)
- Save the message, make it visible and move it to the out-box
- Send the message in the background
Example code for these steps is shown below:
- Set context to the Draft folder:
iMmsMtm->SwitchCurrentEntryL( KMsvDraftEntryId );
- Create the message and retrieve its TMsvId:
iMmsMtm->CreateMessageL( iMmsMtm->DefaultSettingsL() ); TMsvId entryId=iMmsMtm->Entry().EntryId();
- Set message parameters:
iMmsMtm->SetMessagePriority(EMmsPriorityHigh); iMmsMtm->SetDeliveryReport(EMmsDeliveryReportNo); iMmsMtm->SetReadReply(EMmsReadReplyNo); iMmsMtm->AddAddresseeL( *aRecipient);
- Add attachments and set their content IDs:
TMsvId attachmentID = KMsvNullIndexEntryId; TFileName attachmentFile1(_L("javascript:void(null);")); iMmsMtm->CreateAttachment2L( attachmentID, attachmentFile1 ); iMmsMtm->SetAttachmentTypeL(attachmentID, textPlain); iMmsMtm->SetAttachmentCidL(attachmentID, _L8("A1"));
- Set the message root. That is, specify which attachment contains the Synchronized Multimedia Integration Language (SMIL) script. Put another way; indicate which attachment has the SMIL:
iMmsMtm->SetMessageRootL(attachmentID);
- Save the message, make it visible and move it to the out-box:
TMsvEntry ent = iMmsMtm->Entry().Entry(); ent.SetInPreparation(EFalse); ent.SetVisible(ETrue); iMmsMtm->Entry().ChangeL(ent); iMmsMtm->SaveMessageL(); iMmsMtm->Entry().MoveL(entryId,KMsvGlobalOutBoxIndexEntryId); iMmsMtm->SwitchCurrentEntryL( entryId );
- Send the message in the background:
CMsvOperationWait* wait = CMsvOperationWait::NewLC(); wait->iStatus = KRequestPending; CMsvOperation* op = NULL; op = iMmsMtm->SendL( wait->iStatus ); wait->Start(); CleanupStack::PushL( op ); CActiveScheduler::Start(); TInt result=op->iStatus.Int(); CleanupStack::PopAndDestroy(2);
|