Click here to Skip to main content
Click here to Skip to main content

Mobile Birthday Reminder and Automatic SMS Sender

, 4 Jul 2010 CPOL
Rate this:
Please Sign up or sign in to vote.
This code sends automatic SMS to birthday boys/girls :) from phone

Introduction

Hello people, how are you? I am fine, thank you.

Mobiles have become an integral part of our lives. They have become better than our better halves acting as schedulers, reminders, organizers, file sharers, personalized music systems and much much more than one can expect. I am myself a phone freak. For 3 years, I was a Nokia fan (Symbian OS) and now I am a Windows mobile fan.

Owning a Windows Mobile offers a lot to a Windows developer. If you know .NET coding, you can create cool customized applications for your phone.

How It Works

I am suffering a birthday memory loss and often get beaten up by my wife, embarrassed by friends for forgetting their birthdays. To overcome this tendency of mine, I made this cool tool for my rescue.

My code in the phone scans the application database filled with people’s information for their birthdate to match with the current date. If it matches, the code sends an SMS to the person’s mobile number and to the owner mobile as well (for owner’s reminder) automatically. Now no need to remember any birthday, just feed it once in the application and forget it. The code will take care of the rest.

Pre-Requisites

You need a phone that supports .NET Compact Framework (.NET CF) 3.0 and SQL Server CE (Compact Edition). Windows mobile 6.0 above supports it by default. For Symbian mobiles, .NET CF was available from Red Five Labs but these days, I don’t know why, their website is not working so you need to Google a bit to find out from where you can download that.

List of files explicitly required to be installed on phone are:

  1. Sqlce.dev.ENU.phone.wce5.armv4i.cab
  2. Sqlce.dev.ENU.wce.armv4i.cab
  3. Sqlce.ppc.wce5.armv4i.cab
  4. Sqlce30.wce5.armv4i.cab
    (You will find these files (1 to 4) in the SQL Server 2005 CE folder.)
  5. Scheduler (attached with the article)

For development, you need Visual Studio 2005/2008 IDE and Smartphone development SDKs.

Tip

You can download the following for development purposes:

Preparing User Interface

Well that’s a piece of cake; all you need is a little creativity as the phone screen is relatively smaller than a computer/laptop. Tabbed control is very useful as you can segregate your functionality in multiple tabs so the screen breathes with space and doesn’t look jammed up.

I am posting pictures of UI I used in my application. Feel free to customize it the way you want.

To create a mobile application, open Visual Studio 2005/2008 and create a new project. This will open a New Project Window. Select Smart Device under your preferred language.

MobileBirthdayReminder/1.png

Clicking OK will further open a screen for choosing smart phone platform type.

MobileBirthdayReminder/2.png

Select Device Application here.

Screen #1 Detailed View

MobileBirthdayReminder/3.png

Here we get per record detail for each field. Forget the “Stop the Timer” button as of now, I will explain it later.

Screen #2 Grid View

MobileBirthdayReminder/4.png

Shows all the records on one screen.

Screen #3 Message window

MobileBirthdayReminder/5.png

This screen shows a Text box which contains the message that will be sent automatically to the birthday boy/girl.

Screen #4 About screen, not important for you.

MobileBirthdayReminder/6.png

I deserve to have credits for my work after getting those brutal beatings from my wife.

The controls used here are no different than the ones used in .NET Windows applications, a little bit of change in the way they are coded and few reduced functionalities (as mobile has limited memory and resources).

Source Code

Nothing techy, here is the walkthrough:

  1. Prepare the table structure. Open SQL Sever Management studio and create a new table. It will save the database at your selected location with SDF extension. Example – abc.sdf

    MobileBirthdayReminder/7.png

    The field “sno” is auto generated primary key.

  2. Add this newly create table inside “sdf” file database into your application. Adding the database will prompt you for creating DataSet. Go ahead and create it. This will add Dataset Table Adapter and binding source to your project.

    MobileBirthdayReminder/8.png

All set, now we are ready to roll. The Table Adapter is very useful as it makes life easier for performing the DML (Data Manipulation Language) tasks, like for deleting a record you just need to write this piece of following code:

BirthDayInfoTableAdapter.Delete(<primary key value to be deleted>)

BirthDayInfoTableAdapter.Fill(BirthDayInfoDataSet.BirthDayInfo)

Now in the above code we first delete the record, refill the dataset (kind of refresh the dataset).

The main code for checking the birthday is: 

For i = 0 To BirthDayInfoDataSet.BirthDayInfo.Rows.Count - 1

If BirthDayInfoDataSet.BirthDayInfo(i).dateOfBirth.Day = Date.Now.Day And _
    BirthDayInfoDataSet.BirthDayInfo(i).dateOfBirth.Date.Month = Date.Now.Month Then
Dim sms As New SmsMessage(BirthDayInfoDataSet.BirthDayInfo(i).mobileNumber, 
    _ "Hi " & BirthDayInfoDataSet.BirthDayInfo(i).fullName & vbCrLf & txtMessage.Text)
sms.Send()

Dim sms2 As New SmsMessage("mobile number", _ 
"Hi " & BirthDayInfoDataSet.BirthDayInfo(i).fullName & vbCrLf & txtMessage.Text)
sms2.Send()
End If
Next 

It matched, all the birthdates and months are stored in table with the current date and month. If matched, send SMS, else skip. SmsMessage is an inbuilt library for sending messages.

So this is the main recipe for the project and to add a dessert, I added the “Stop the Timer” button. When the code fires, the window will remain open and consume your phone's valuable memory and hence drain battery, so I added a timer which automatically closes the application after 10 seconds. So when you put the application in scheduler (by using the Scheduler application attached in the article), the code will run at your specified time and day of the week, check birthdays, sends SMS to deserving entries and close automatically. So as the application closes automatically, I added that “Stop the timer” button which if you click within 10 seconds will disable closing of the application (for that time only).

The Climax

So after this long article, I have covered the main bits of the application. You can find the rest of the goodies in the code attached. I hope you find this code interesting to use, if you don’t, feel free to abuse me with all your heart.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Amit Kumar Tiwari
Technical Lead
India India
I am module lead with experience in Microsoft Technologies like .NET, SharePoint etc.
Follow on   Google+

Comments and Discussions

 
QuestionHow to install in my windows phone PinmemberMember 87249874-Sep-12 0:29 
Questioninsert,delete or update PinmemberMember 87249878-Aug-12 5:02 
GeneralMy vote of 5 PinmemberBryian Tan27-Jan-11 12:10 
Generalmail the code please PinmemberAnand Kumar296-Nov-10 7:13 
Generalkeyboard is disable in scheduler Pinmemberankitchouksey13-Oct-10 7:55 
GeneralMy vote of 5 PinmvpMd. Marufuzzaman10-Aug-10 22:37 
Questionthe first zip file can't be downloaded? Pinmembermargiex18-Jul-10 7:17 
AnswerRe: the first zip file can't be downloaded? Pinmemberangabanga20-Jul-10 1:40 
GeneralRe: the first zip file can't be downloaded? Pinmembermargiex20-Jul-10 2:15 
that works. thanks.
GeneralSoon outdated mobile platform Pinmemberysliew77@yahoo.com4-Jul-10 14:17 
GeneralRe: Soon outdated mobile platform PinmemberJoel Ivory Johnson13-Jul-10 19:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.141216.1 | Last Updated 5 Jul 2010
Article Copyright 2010 by Amit Kumar Tiwari
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid