开发者

SMS scheduling in symbian c++

how to send SMS after 4 days from a Symbian app by running the application in the bachground. Means application sends SMS after 4 开发者_Python百科days? Is that possible?

Please reply soon.


I don't think you would want to achieve this by running your application in the background for 4 days. For a start, if the phone was rebooted or ran out of battery in that time then the SMS wouldn't get sent when it was switched on again.

Instead, you can use the message centre API to schedule the SMS to be sent at a particular time.

The TMsvEntry class lets you call:

SetScheduled(ETrue);
SetSendingState(KMsvSendStateScheduled);

and then you can set TMsvEntry::iDate which is a TTime to the date/time you want the message to be sent.

This example shows how to send an SMS, try looking at:

void CSmsEngine::SendSmsL(const TDesC& aAddr, const TDesC& aMsg)

Comment out the SendSMSInThirdEditionL call, since you need to use the older API. Make your changes in:

TMsvId CSMSExampleMtmsEngine::CreateSMSMessageL(const TDesC& aAddress,

                                              const TDesC& aMessage)

Alternatively, if what you want to achieve is to send an SMS every 4 days, then you can use the Symbian Task Scheduler to do this. You can create an EXE which sends the SMS, then create a task which will run the EXE every 4 days. It will not keep anything running in the background so it won't waste battery, and it will remember to run the task even if you reboot the phone in between runs, since it persists the schedule to disk.

This example shows how to create a task - so in the DoRunTaskL function you can send an SMS, for instance.

This example shows how to schedule the task itself.

So to start your SMS sending schedule you would need to do something like that but edit the schedule to be every 4 days.

I would say that this is a relatively advanced programming challenge on Symbian. So if you are new I'd recommend doing some of the tutorials, reading the books etc. before starting it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜