Namespaces
Variants
Actions

Archived:New API to access SMS settings in S60 3rd Edition (Known Issue)

Jump to: navigation, search
Archived.png
Archived: 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}}.

Using deprecated CSmsSettings store/restore functions can lead to errors when sending an SMS message on a S60 3rd Edition device.

Article Metadata

Compatibility
Platform(s): S60 3rd Edition

Article
Created: User:Technical writer 1 (20 Aug 2007)
Last edited: hamishwillee (21 Jun 2012)

Overview

Due to platform security on S60 3rd Edition, all messaging settings have been moved into the Central Repository data storage. This transition led to the deprecation of the old SMS settings API (that is, using CSmsSettings store/restore functions). Using these deprecated methods can lead into KErrGsmSMSUnspecifiedProtocolError, KErrGsmSMSInvalidMandatoryInformation errors when sending an SMS message on a S60 3rd Edition device.

Description

// ----------------------------------------
//
// Sets the message center to the message
//
// ----------------------------------------
TInt CFW3MsgEngine::SetSMSCL()
{
TInt err = 0;
// CSmsHeader encapsulates data specific for sms messages,
// like service center number and options for sending.
CSmsHeader& header = iMtm->SmsHeader();
CSmsSettings* settings = CSmsSettings::NewL();
CleanupStack::PushL(settings);
CSmsNumber* sc = CSmsNumber::NewL(); //CSmsNumber* sc = 0;
CleanupStack::PushL(sc);
//--------- SMSC & header set-up
settings->CopyL(iMtm->ServiceSettings()); // restore existing settings
// set send options
settings->SetDelivery(ESmsDeliveryImmediately); // set to be delivered immediately
header.SetSmsSettingsL(*settings);
// Set SMSC address
if (header.Message().ServiceCenterAddress().Length() == 0)
{
// No smsc set. We assume there is at least one sc number defined and use
// the default SC number.
CSmsSettings* serviceSettings = &(iMtm->ServiceSettings());
// if number of scaddresses in the list is null
if (!serviceSettings->ServiceCenterCount()) // New messaging API uses new methods
{
// here there should be a dialog in which user can add sc number
_LIT(KNotSet,"SMSC not set");
// Display a Note
CAknGlobalNote* globalNote = CAknGlobalNote::NewLC();
globalNote->ShowNoteL(EAknGlobalInformationNote, KNotSet);
CleanupStack::PopAndDestroy(); // globalNote
}
else
{
// set sc address to default.
sc->SetAddressL((serviceSettings->GetServiceCenter(serviceSettings->DefaultServiceCenter())).Address()); // New messaging API uses new methods
header.Message().SetServiceCenterAddressL(sc->Address());
}
}
//--------- SMSC & header set-up
CleanupStack::PopAndDestroy(2); // sc, settings
return err;
}
This page was last modified on 21 June 2012, at 08:11.
145 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved