I’ve had a lot of requests for SMS related applications. So today we will create a SMS logger application. This application will allow users to scroll through a listing of all the SMS / text messages they have received while the application has been running.
SMS Logger
This is a great application for a beginner to create. It has a very simple UI, the main component is the WebBrowser. The way we can have nicely formatted text easily.
The key piece of code here is the MessageRecieved event off of the SmsIntercepter object.
1: private StringBuilder documentText = new StringBuilder();
2: void SmsInterceptor_MessageReceived(object sender, MessageInterceptorEventArgs e)
3: {
4: if (enableInterceptor == false)
5: return;
6:
7: // Cast to SmsMessage to access message body
8: // Not expecting to receive any non-SMS messages but use "as" to
9: // cast to be extra safe
10: SmsMessage newMessage = e.Message as SmsMessage;
11: if (newMessage != null)
12: {
13: documentText.AppendFormat(@"<b>Body:</b> {0}<br/>", newMessage.Body);
14: documentText.AppendFormat(@"<b>Name:</b> {0}<br/>", newMessage.From.Name);
15: documentText.AppendFormat(@"<b>Address:</b> {0}<br/>", newMessage.From.Address);
16: documentText.AppendFormat(@"<b>Last Modified:</b> {0}<br/>", newMessage.LastModified);
17: documentText.AppendFormat(@"<b>Received:</b> {0}<br/>", newMessage.Received);
18: documentText.Append(@"<br/>");
19:
20: webBrowser.DocumentText = documentText.ToString();
21: }
22: }
We have a few actions the user do: Start, Stop, Clear, About, and Exit.
Possibilities:
This application logs incoming SMS messages, but it doesn’t do several thing that were requested from our reader. It doesn’t log outgoing messages. It doesn’t save to a text file. And it doesn’t clear out data from Outlook Mobile when the users runs SMS Logger.
I also think there is room to improve the UI. I think some small 16x16 pixel graphic files could really add some life to the application. Maybe one icon for incoming messages, and one for outgoing messages.
So who’s up to it? Anyone want to take this application to the next level? Just let me know.
Download executable: smsLogger.cab
Download Source Code: smsLogger.zip
Feedback:
So what possibilities do you see for this type of application? for business? for entertainment?