SMSComposer

This plugin allow you to open up the SMS composing interface and optionally prefil the recipients and message parts
almost1.3.30
platforms: ios
$ cordova plugin add SMSComposer

Cordova 3.0.0 support added 14 August 2013 - @almost

Cordova 2.8.15 support added August 2013 - @almost

Cordova 2.2.0 functionality check Nov 13 2012 - @RandyMcMillan

Cordova 1.5.0 support added March 29 2012 - @RandyMcMillan

StatusBarHidden issue addressed

Comment/Uncomment line 56 in SMSComposer.m if your app shows/hides the statusbar when it is launched

SMSComposer.m LINE 56: [[UIApplication sharedApplication] setStatusBarHidden:YES];///This hides the statusbar when the picker is presented -@RandyMcMillan

PhoneGap SMSComposer

by Grant Sanders

Adding the Plugin to your project

Using this plugin requires PhoneGap for iPhone.

  1. Add the SMSComposer.h and SMSComposer.m files to your "Plugins" folder in your PhoneGap project
  2. Add the SMSComposer.js files to your "www" folder on disk, and add a reference to the .js file after phonegap.js.
  3. Add the MessageUI framework to your Xcode project. In Xcode 4, double-click on the target, select "Build Phases" -> "Link Binary with Libraries" -> "+" and select "MessageUI.framework".
  4. Add the plugin to the PhoneGap.plist under Plugins (key: "SMSComposer" value: "SMSComposer")

RELEASE NOTES

20130814

  • Support for Cordova 3.0.0

20130801

  • Support for Cordova 2.8.15

20120219

  • Fix for deprecations in PhoneGap 1.4.x
  • Added PhoneGap.plist instructions in README.md

201101112

  • Initial release
  • Adds SMS text message composition in-app.
  • Requires iOS 4.0 or higher. Attempts to compose SMS text without running 4.0+ fails gracefully with a friendly message.

EXAMPLE USAGE

  • All parameters are optional. window.plugins.smsComposer.showSMSComposer();

  • Passing phone number and message. window.plugins.smsComposer.showSMSComposer('3424221122', 'hello');

  • Multiple recipents are separated by comma(s). window.plugins.smsComposer.showSMSComposer('3424221122,2134463330', 'hello');

  • showSMSComposerWithCB takes a callback as its first parameter.

  • 0, 1, 2, or 3 will be passed to the callback when the text message has been attempted.
    window.plugins.smsComposer.showSMSComposerWithCB(function(result){

        if(result == 0)
            alert("Cancelled");
        else if(result == 1)
            alert("Sent");
        else if(result == 2)
            alert("Failed.");
        else if(result == 3)
            alert("Not Sent.");

    },'3424221122,2134463330', 'hello');
  • A fully working example as index.html has been added to this repository.
  • It is an example of what your www/index.html could look like.