Click here to Skip to main content
15,861,168 members
Articles / Mobile Apps

Mobile Birthday Reminder and Automatic SMS Sender

Rate me:
Please Sign up or sign in to vote.
4.91/5 (16 votes)
4 Jul 2010CPOL5 min read 79.8K   13.8K   38   12
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:

VB.NET
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: 

VB.NET
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)


Written By
Technical Lead
United States United States
I am a developer in Microsoft Technologies like .NET, SharePoint etc.

Comments and Discussions

 
GeneralWe have a simple solution called Beyond Mobile Wishday to get Birthday Reminder and Automatic SMS work done Pin
Member 1265589426-Jul-16 22:52
Member 1265589426-Jul-16 22:52 
QuestionHow to install in my windows phone Pin
Member 87249873-Sep-12 23:29
Member 87249873-Sep-12 23:29 
Questioninsert,delete or update Pin
Member 87249878-Aug-12 4:02
Member 87249878-Aug-12 4:02 
GeneralMy vote of 5 Pin
Bryian Tan27-Jan-11 11:10
professionalBryian Tan27-Jan-11 11:10 
Generalmail the code please Pin
Anand Kumar296-Nov-10 6:13
Anand Kumar296-Nov-10 6:13 
Generalkeyboard is disable in scheduler Pin
ankitchouksey13-Oct-10 6:55
ankitchouksey13-Oct-10 6:55 
GeneralMy vote of 5 Pin
Md. Marufuzzaman10-Aug-10 21:37
professionalMd. Marufuzzaman10-Aug-10 21:37 
Questionthe first zip file can't be downloaded? Pin
margiex18-Jul-10 6:17
margiex18-Jul-10 6:17 
AnswerRe: the first zip file can't be downloaded? Pin
angabanga20-Jul-10 0:40
angabanga20-Jul-10 0:40 
GeneralRe: the first zip file can't be downloaded? Pin
margiex20-Jul-10 1:15
margiex20-Jul-10 1:15 
GeneralSoon outdated mobile platform Pin
ysliew77@yahoo.com4-Jul-10 13:17
ysliew77@yahoo.com4-Jul-10 13:17 
GeneralRe: Soon outdated mobile platform Pin
Joel Ivory Johnson13-Jul-10 18:49
professionalJoel Ivory Johnson13-Jul-10 18:49 

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

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