Titanium SMS Module

Need a SMS Dialog in your Titanium app?

The benCoding.SMS module makes it easy to add SMS functionality into your iOS Titanium apps. We unleash the power of Apple’s native Apple SMS component to Titanium with an API fashioned after the Titanium EmailDialog to make it familiar to use. 

See the below on how to get started using this in your Titanium apps today.

Want To Download The Module?

You can download the compile module here.  Please take a look at the “Before You Start” section to make sure you have all of the module dependencies.

Interested In The Source?

The source is available in the benCoding.SMS repo on GitHub.

Before You  Start

  • You need Titanium 1.8.1 or greater
  • This module will only work with iOS 4 or great.

How Does It Work?

This module provides Titanium access to the native Apple SMS component MFMessageComposeViewController.  The module’s API has been fashioned after the Titanium EmailDialog to make it familiar to use.

What Does It Look Like?

 Example AppDialog Sample  Completed Event 

Documentation & Examples

For the example app shown above and full html documentation please check out the documentation and example folders in the module zip.

How Do I Use It?

//Create SMSDialog object
var sms = require('bencoding.sms').createSMSDialog({ barColor:'#336699' });

Ti.API.info("Is This Feature Supported? => " + sms.canSendText);
//This is an example of how to check if the device can send Text Messages
if(!sms.canSendText){
	var noSupport = Ti.UI.createAlertDialog({
			title:'Not Supported',
			message:"This device doesn't support sending text messages" 
	}).show();

	return;

}else{

	//Set the SMS message, you can also do this when you create the SMSDialog
	sms.setMessageBody("Appcelerator Titanium Rocks!");
	
	//Set the SMS ToRecipients you can also do this when you create the SMSDialog
	//This is an array so you can pass in several numbers for the message
	sms.setToRecipients(["555-555-1234","444-444-1234"]);
	
	//This call opens the SMS Message Dialog
	sms.open({
		animated:true //Animated on open (OPTIONAL)
	});
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s