Created
June 16, 2010 17:34
-
-
Save reflog/440998 to your computer and use it in GitHub Desktop.
This file contains 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
public static boolean SendSMS(String phone, String text){ | |
try { | |
String smsurl = "sms://+"+phone; | |
MessageConnection conn = | |
(MessageConnection)Connector.open(smsurl); | |
TextMessage msgOut = (TextMessage) conn.newMessage(MessageConnection.TEXT_MESSAGE); | |
msgOut.setPayloadText(text); | |
Utils.log("sending to "+smsurl); | |
conn.send(msgOut); | |
return true; | |
} catch (Throwable e) { | |
Utils.log("Cannot send sms: "+e + " msg: "+e.getMessage()); | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment