Created
June 7, 2011 21:31
-
-
Save omorandi/1013226 to your computer and use it in GitHub Desktop.
Two methods for sending SMS messages with Titanium Mobile on Android throught native intents
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var win1 = Titanium.UI.createWindow({ | |
title:'Tab 1', | |
backgroundColor:'#fff', | |
layout: 'vertical' | |
}); | |
var bt1 = Ti.UI.createButton({title: 'send message (method 1)', top: 200}); | |
bt1.addEventListener('click', function(e) | |
{ | |
var intent = Ti.Android.createIntent({ | |
action: Ti.Android.ACTION_SENDTO, | |
data: 'smsto:123456789' | |
}); | |
intent.putExtra('sms_body', 'new message from me'); | |
Ti.Android.currentActivity.startActivity(intent); | |
}); | |
win1.add(bt1); | |
var bt2 = Ti.UI.createButton({title: 'send message (method 2)'}); | |
bt2.addEventListener('click', function(e) | |
{ | |
var intent = Ti.Android.createIntent({ | |
action: Ti.Android.ACTION_VIEW, | |
type: 'vnd.android-dir/mms-sms' | |
}); | |
intent.putExtra('sms_body', 'new message from me'); | |
intent.putExtra('address', '123456789'); | |
Ti.Android.currentActivity.startActivity(intent); | |
}); | |
win1.add(bt2); | |
win1.open(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey! How can you get the status? I need to know if the message was sent or not, is it possible? Thanks!