Open the Java Eclipse software development program on your desktop. Open the Android project in which you want to add an SMS module. Double-click the Java file you want to use to send the message.
2Add the wireless messaging library to the top of the file. You need this library to call the necessary functions. Copy and paste the following import statement to the top of the file:
import javax.wireless.messaging.*;
3Create a connection to the wireless phone number. The following code sets up a variable with the target phone number:
this.connection=(MessageConnection) Connector.open("sms://5555555555:2948");
The "2948" is the port number used to run the SMS service. Replace the "5555555555" with the mobile phone number you want as your recipient.
4Set up the message content. The following code sets up a string variable with the content "Hello, Recipient" as the message:
String message ="Hello, Recipient";
5Send the message. The following code packages the SMS message and sends it to your recipient phone number:
this.connection.send(message);
Read Next: Copyright © 1999-2012 Demand Media, Inc.Use of this web site constitutes acceptance of the eHow Terms of Use and Privacy Policy. Ad Choices en-US
No comments:
Post a Comment