Unlike Windows Mobile with Windows Phone 7 we are currently unable to directly send an SMS from within an application unless we show the composer screen using SMSComposerTask. This does suck a little bit as we now Aps cant send SMS’s direct or intercept them at all for that matter. So what does WP7 offer – well to send an SMS you can use SMSComposerTask and to intercept an SMS – nothing, you will need to re-think your application architecture
To send an SMS using the composer in Windows Phone 7 you need to do the following:Â Â Â
- Add using statement to Tasks namespace
- Create an instance of SMSComposerTask set the To field and body then call Show:
- Result
using Microsoft.Phone.Tasks;
SmsComposeTask sms = new SmsComposeTask(); sms.To = "0123456789"; sms.Body = "Some prefilled text..."; sms.Show();
If your application really can’t live without direct access to send and intercept an SMS without any user interaction in the composer:Â Â Â
- Then you can wait and they may add it in future releases although I am unsure if this will ever occur and I would not rely on it
- Or you may be able to rework your architecture to replace SMS with Push Notifications, a WCF service and Database or XML as your storage. The obvious downside to this is that you loose the telcos serverside infrastructure and have to replace it yourself. This adds a lot more code and cost to the developer for implementation and continual subscription costs for hosting which then means your cool free App idea may become too costly.
If your application can live without SMS interception but needs direct access to send and SMS without any user interaction in the composer:
- Then you may be able to use those options listed above
- Or, look into SMS providers that provide a web service based API – needless to say if you can’t figure out how to oncharge this to the end user this will also cost you but it may be significantly less then hosting depending on your volume
 Nick   Â
  Â

Pingback: Stepping into the Globe of SMS Cell Phone Advertising and marketing | Web Hosting UK Blog