SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software Kodyaz Development Resources
Development resources, articles, tutorials, samples, codes and tools for .Net, SQL Server, Vista, etc.







How to Send SMS Message using SmsComposeTask in a Windows Phone 8 App

SmsComposeTask class is used to send SMS text messages from a Windows Phone 8 app by Windows Phone app developers. SmsComposeTask (SMS compose task) is one of Windows Phone Launchers and SmsComposeTask is used to launch Messaging app on user's Windows Phone smartphone. Developers can predefine the SMS text message properties within app code like the body text and the SMS recipient. Although a Windows Phone developer can set all required properties of the SmsComposeTask, only the phone user has the permission to send the SMS by pressing the send button in Messaging app.

SmsComposeTask

SmsComposeTask Windows Phone Launcher can be used for Windows Phone 7.1 and Windows Phone 8 app development. To use Windows Launcher SmsComposeTask developers must include Microsoft.Phone.Tasks namespace in their app code. Here is a sample

' VB.NET code
Imports Microsoft.Phone.Tasks
// C# code
using Microsoft.Phone.Tasks;

Now programmers can use the SmsComposeTask class in their Windows Phone 8 app to send SMS message from their smartphone. Let's add a button or an image control on the design surface of your WP8 app page. In this tutorial, we will use this button or image to trigger an event in code behind of the MainPage.xaml to send SMS text to a recipient.

send SMS message from Windows Phone 8 app using SmsComposeTask Windows Phone Launcher
Send SMS message from Windows Phone 8 app using SmsComposeTask Windows Phone Launcher

You can see above that I used an SMS message image and put it on MainPage.xaml of my recent Windows Phone 8 app development Time Management Quotes app.

Using the Properties of the SMS Image control, switch to Events properties. Now scrolldown the possible event handlers and create a Tap event for the SMS message. If you check the code behind page MainPage.xaml.vb of WP8 app page MainPage.xaml, you will see the event handler

In code behind, SMS image Tap event code executes sendSMS method that the app developers can customize according to their requirements. sendSMS creates an instance of SmsComposeTask Windows Phone Launcher class. SmsComposeTask instance Body property and To property can be set by code as shown in below VB.NET codes. For my quotes app, I populate the SmsComposeTask.Body property with the quote text which the user selects in app.

Send SMS message using SmsComposeTask Windows Phone Launcher
Send SMS message using SmsComposeTask Windows Phone Launcher

Private Sub sms_Tap(sender As Object, e As GestureEventArgs) Handles sms.Tap
 Dim quote As Quote = TimeTrackingQuotes.Read(currentQuoteNo)
 If Not quote Is Nothing Then
  sendSMS(quote)
 End If
End Sub

Private Sub sendSMS(quote As Quote)

 Dim smsComposeTask As SmsComposeTask = New SmsComposeTask()

 'smsComposeTask.To = ""
 smsComposeTask.Body = quote.QuoteText
 smsComposeTask.Show()

End Sub

When the Show() method of the SmsComposeTask class instance is executed, the default Messaging app on the users Windows Phone 8 device launched and display SMS message with configured values ready to be send. The Windows Phone user can change the SMS message and choose the recipients of the text message by using the Messaging app. Only when he/she presses Send button the message will be send.

use SmsComposeTask Windows Phone Launcher to send SMS message  Windows Phone Messaging app to send SMS text
Compose and send SMS message from Windows Phone 8 app using SmsComposeTask Windows Phone Launcher

Programmers can use other Windows Phone Launchers WebBrowserTask, EmailComposeTask and ShareLinkTask in their Windows Phone 8 app development codes to provide additional communication functionalities in their apps.





Windows Phone 8

WP8 App Development

Windows Phone SDK

Register Phone

WP8 App Download Count

Windows Phone App

Windows Phone Launchers

WP8 Accent Colors

LaunchUriAsync URI Scheme

WP8 Kid's Corner

WP8 Features

Nokia Lumia 920





Windows 8

Windows 8 Tutorials

Windows 8 Download

Install Windows 8

Windows 8 Product Key

Windows 8 Tips

Windows 8 Games


Windows 8 tablet

Microsoft Surface

Samsung Slate 7

Asus Taichi


Windows 8 Phones

Nokia Lumia 920

Windows Phone 8 App Development

Register Phone

Windows Phone 8 Features








Microsoft Windows 8 Downloads, tutorials, guides and how-to documents

Microsoft Windows 8 Download
How to Create Flip Tile Programmatically in Windows Phone 8 App
How to Create Cycle Tile Programmatically in Windows Phone 8 App
New Windows Phone 8 Features
Download Windows Phone SDK 8 for Visual Studio 2012 and Windows Phone Emulator
Add Search Providers like Google Search Provider to Internet Explorer 10 IE10
Enable and Configure Kid's Corner on Windows Phone 8 Smartphones
How to Change Windows Phone 8 Broadcast Name
How to Change Windows Phone 8 Device Name
Download Windows Phone App for Windows 8
Windows Phone 8 App Development: A Quick Start Guide
Search for an App on Windows 8 App Store
Reinstall App Store for whom Removed Windows App Store
Create Picture Password for Windows 8 User
Windows 8 Tips - Windows 8 Close App
Group and Name Windows 8 Tiles on Start Screen
Learning Windows 8 Diary - What I learnt today
Windows 8 Installation Stuck at Getting Devices Ready
Rate Windows 8 Performance using Windows Experience Index
Windows 8 File Explorer aka Windows 8 Explorer
Pin Program to Taskbar using Windows 8 Pin to Taskbar option
How to Change Windows 8 Language
Windows 8 Wallpapers
How to Shutdown Windows 8
Windows 8 App Development using Visual Studio 11 Express
Windows 8 Installation (Windows Consumer Preview)
Install Windows 8 on Virtual Machine Oracle Virtual Box Configuration
Windows 8 Screenshots from Windows Consumer Preview Beta
Windows 8 Product Key to for Windows Consumer Preview Setup
Windows 8 Installation Compatibility Advisor Report
Tweet@rama Windows 8 Application for Twitter
Microsoft Windows 8 Activation using Desktop Control Panel
Windows 8 Product Key to Reinstall Windows 8
Change Screen Resolution in Windows 8 for Metro-Style Applications
How to Install Windows 8 - Installation Screenshots
New Windows Task Manager in Windows 8
Windows 8 Startup Repair with System Restore
How to Change Windows 8 User Account Picture
Windows 8 Tips and Tricks
Windows 8 Setup Error: HAL_INITIALIZATION FAILED. Your PC ran into a problem that it couldn’t handle, and now it needs to restart.
Windows 8 Games
Windows 8 with Windows 8 Xtreme






Copyright © 2004 - 2014 Eralper Yilmaz. All rights reserved.
Community Server by Telligent Systems