S60 Platform: SMS Example v2.1
------------------------------
This C++ example demonstrates programmatical handling of SMS messages. Messages
can be sent from the application and they can be received directly into the
application (that is, catching incoming messages before the user gets any
notification). In addition, messages can be deleted, copied, or moved to other
folders of the message store (inbox, outbox, drafts). The example has been updated
to be compatible with S60 5th Edition and touch UI.
PREREQUISITES
-------------------------------------------------------------------------------
- Active objects
- Symbian OS key concepts
- Messaging key concepts
IMPORTANT CLASSES
-------------------------------------------------------------------------------
CSMSExampleEngine | Main engine class
CSMSExampleMtmsEngine | SMS handling (deleting, copying, moving, sending,
msg bodies, msg address)
CLogView | Visualizes what has happened
CListboxView | Manages Listbox command handling and performs
operations on selected messages.
CMarkableListContainer | SMS message container. Selects groups of messages.
CSMSExampleParser | Searches for a number which has exactly 10 digits
from the SMS message body.
CSMSExampleAppUi | Manages command handling and captures (automatically)
received messages. Also performs automatic deletion of
the received messages if the feature is enabled.
REQUIRED CAPABILITIES
-------------------------------------------------------------------------------
- NetworkServices
- LocalServices
- ReadUserData
- WriteUserData
- UserEnvironment
KNOWN ISSUES
-------------------------------------------------------------------------------
None.
TOUCH UI SUPPORT
-------------------------------------------------------------------------------
In the previous version of the example application, two events were handled in CMarkableListContainer::HandleListBoxEventL()
method for selection of listbox items in message lists: MEikListBoxObserver::EEventEnterKeyPressed and
MEikListBoxObserver::EEventItemClicked.
However, in order to support Touch UI correctly (first focus and then selection), EEventItemDoubleClicked needs to be used instead of EEventItemClicked:
void CMarkableListContainer::HandleListBoxEventL(CEikListBox* /*aListBox*/,
TListBoxEvent aListBoxEvent)
{
// if the Select Key has been pressed
if ((aListBoxEvent == MEikListBoxObserver::EEventEnterKeyPressed) ||
(aListBoxEvent == MEikListBoxObserver::EEventItemClicked))
{
MarkOrUnMarkL();
}
}
RUNNING THE EXAMPLE
-------------------------------------------------------------------------------
Log view:
The default view is the log. The log collects all events and displays
information about every event that has happened. The log tells, for example,
when a new message has arrived and displays its body text/address. Please be
patient if your folders are large; listing operations may take several seconds.
Note that the messages moved or copied from the inbox cannot be edited because the
messages have their "complete" flag on.
The commands in the Options menu are as follows:
1. "Send SMS".
1.1 "Address query". Enter SMS recipient. For example "050 123 4567".
1.1.1 "SMS body text". Write SMS body text. Max 160 characters.
2. "Move message".
2.1 "From drafts". Source folder: drafts.
2.1.1 "To inbox". Target folder: inbox.
2.1.2 "To outbox". Target folder: outbox.
2.2 "From outbox". Source folder: outbox.
2.2.1 "To inbox". Target folder: inbox.
2.2.2 "To drafts". Target folder: drafts.
2.3 "From inbox". Source folder: inbox.
2.3.1 "To outbox". Target folder: outbox.
2.3.2 "To drafts". Target folder: drafts.
3. "Copy message".
Same as 2. but the operation is Copy.
4. "Delete message".
4.1 From drafts. Delete messages from drafts.
4.2 From outbox. Delete messages from outbox.
4.3 From inbox. Delete messages from inbox.
5. "Settings"
5.1 "Automatic delete on". Set this option if you want to delete received
SMS messages automatically. NOTE! This feature will delete every SMS
message that has arrived while it is on. Be careful with it although
it shows the message address/content before deletion. There is a slight
delay between message arrival and message automatic deletion because
ncnlist panics if there is no time to play the "message has arrived"
tone.
5.2 "Automatic delete off". Set this option if you do not want to delete
received SMS messages automatically (Default).
Listbox view:
Choose a group of messages for which to perform an operation.
The commands in the Options menu are as follows:
6. "Select all". Select all SMS messages of the chosen source folder.
7. "Deselect all". Deselect all SMS messages.
Tip: Use the navigation key to select or deselect a message.
8. "Done". Execute an operation for selected messages. (See items 2, 3, and 4).
The Log is notified of the executed operation.
9. "Back". Return to the log view and do nothing.
BUILD & INSTALLATION INSTRUCTIONS
-------------------------------------------------------------------------------
Mobile device
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Make sure the paths in .pkg files match those on your system.
2. Compile the example:
cd group
bldmake bldfiles
abld reallyclean gcce
abld build gcce urel
3. Make the sis:
cd sis
createsis create SMSExample_3_0_v_2_1_0.pkg
4. Install the signed .sis file to a device.
- If you get a "Certificate error" during installation of a self-signed
package, check that App.Manager -> Settings -> Software Installation is
set to "All."
You can, of course, use a developer certificate for signing.
Emulator (WINSCW)
~~~~~~~~~~~~~~~~~
1. Compile the example:
cd group
bldmake bldfiles
abld reallyclean winscw
abld build winscw udeb
2. Start the emulator.
Note: The emulator observes the Drafts folder instead of the Inbox. Thus it is
possible to see what the example does without real SMS support from the
emulator.
COMPATIBILITY
-------------------------------------------------------------------------------
S60 5th Edition
S60 3rd Edition, Feature Pack 2
S60 3rd Edition, Feature Pack 1
S60 3rd Edition, Maintenance Release
Tested on: Nokia 5800 XpressMusic, Nokia 6220 Classic, Nokia E61i, Nokia E90, Nokia N95, Nokia N95 8GB.
Developed and tested with:
S60 5th Edition SDK
S60 3rd Edition SDK for Symbian OS, Feature Pack 2
S60 3rd Edition SDK for Symbian OS, supporting Feature Pack 1, for C++
S60 3rd Edition SDK for Symbian OS, for C++, Maintenance Release
VERSION HISTORY
-------------------------------------------------------------------------------
2.1 Replaced custom rich text editor with standard implementation.
Listbox item event handling improved to support also touch UI.
Dropped 1st and 2nd Edition support.
Minor bug fixes.
2.0 Ported to S60 3rd Edition. Split the engine and GUI.
Changes in SMS sending, see CSmsEngine::SendSmsL().
Now RSendAs is used to demonstrate its usage. In MTM sending
InvokeAsyncFunctionL(ESmsMtmCommandScheduleCopy,...) had to be changed
to CMsvEntry::CopyL in order for it to work.
Icons are set up differently in S60 3rd Edition, see
CMarkableListContainer::SetupListIconsL
1.0 First release.
IMPROVEMENT IDEAS
-------------------------------------------------------------------------------
CListboxView:
* Get rid of the reference to the engine and implement in MVC style.
CSmsEngine:
* Function GetMessageIds requires that GetFolderSMSMessageInformationL has
been called first.
* See comments in HandleSessionEventL for more improvement ideas.
(There are some ready-made code skeletons for improvements)
EVALUATE THIS RESOURCE
-------------------------------------------------------------------------------
Please spare a moment to help us improve documentation quality and recognize
the examples you find most valuable, by rating this resource.
.