appcelerator-archive / ti.sms

Other
3 stars 2 forks source link

Ti.SMS

Summary

Ti.SMS is an open-source project to support the native iOS SMS dialog in Appcelerator's Titanium Mobile. The module currently supports the following API's:

Requirements

Download + Setup

Download

Setup

Unpack the module and place it inside the modules/iphone/ folder of your project. Edit the modules section of your tiapp.xml file to include this module:

<modules>
    <module platform="iphone">ti.sms</module>
</modules>

Example

var SMS = require('ti.sms');

var SMSDialog = SMS.createSMSDialog({
    barColor: "black",
    toRecipients: ["1234567890", "0987654321"],
    messageBody: "Titanium rocks! 🔥"
});

if (!SMS.canSendText()) {
    Ti.API.error("Device cannot send SMS!");
    return;
}

SMSDialog.addEventListener('complete', function(e) {
    if (e.success) {
        alert('SMS sent!');
    } else {
        switch (e.result) {
            case SMS.CANCELLED:
                alert('User cancelled SMS!');
                break;
            case SMS.FAILED:
            default:
                alert(e.error);
        }
    }
});

SMSDialog.open();

Legal

This module is Copyright (c) 2010-2016 by Appcelerator, Inc. All Rights Reserved. Usage of this module is subject to the Terms of Service agreement with Appcelerator, Inc.