Wednesday, August 29, 2007

Missed call alert for Symbian phones (S60 3rd Edition)

Yesterday I missed a call from my boss when I was taking a day off. I didn't notice that until the evening. This is because my Nokia N80, diff from my previous Motorola E398, doesn't beep or vibrate or give any signal periodically when there is a missed call.

Writing a program to solve this is not difficult, just a matter of finding the API to check the status of missed calls. With Google, that is easy. The Central Repository is supposed to held the information.

// We need to query the central repository
CRepository* cRepository = CRepository::NewLC(KCRUidLogs);

TInt num;
// Get the number of missed calls
User::LeaveIfError(
    cRepository->Get(KLogsNewMissedCalls, num));


But my copy of S60 3rd Edition SDK, Maintenance Release (with Carbide.c++ Express) doesn't has the definition of the constant KCRUidLogs . After some searches and guessing, it turns out that many functionalities of the S60 phones are not defined in the SDK. You will need to get the SDK API Plugin from Nokia.

Anyway, I tried to add the above code into a Hello World project that I have in Carbide. And it is working fine. I also used the CPeriodic class to set a timer to wake up the program periodically. It will beep when there are missed calls.

CPeriodic* iTicker;

......

const TInt KPeriodicTimerInterval5Sec(5000000);
const TInt KPeriodicTimerInterval3Min(1000000 * 60 * 3);
......

iTicker = CPeriodic::NewL(CActive::EPriorityStandard);
// start the timer
iTicker->Start(
    KPeriodicTimerInterval5Sec,
    KPeriodicTimerInterval3Min,
    TCallBack(PeriodicTimerCallBack, this));


TO DO:

  • Make the program to start automatically when the phone boot up. This will probably need me to request a developer certificate from Symbian Signed to sign the application.

  • Stop the application from being killed. When there is not enough memory, the OS will just kill some background programs to free up some memory for the foreground application. Need to find a way to prevent the alert program from being killed.

3 comments:

cc said...

唔係呀嘛!!!我前晚update個firmware update到亂晒龍(由N73 internet edition update去Nokia最新的version),部電話變得好怪 ... 咁樣搞左我兩晚,已經覺得好煩。點知你仲話要幫個電話寫program ~ 我真係五體投地 ~~ UAT完on live時比我試下丫 ~ 不過要有after-try service ~ 多謝晒 ~

cc said...

Downloaded s60 theme creator last night, and ... it is eclipse le !!! woh ... so technical le ... @_@ ~

kc said...

eclipse~ 好野黎嫁~