Android uses a permissions-based policy whereby all the permissions needed by an application must be specified in the AndroidManifest.xml file
To send an SMS message programmatically, you use the SmsManager class.
Call the getDefault() static method to obtain an SmsManager object
send the SMS message using the sendTextMessage() method
private void sendSMS(String phoneNumber, String message)
{
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, null, message, null, null);
}
➤ destinationAddress — Phone number of the recipient
➤ scAddress — Service center address; use null for default SMSC
➤ text — Content of the SMS message
➤ sentIntent — Pending intent to invoke when the message is sent (discussed in more detail in the
next section)
➤ deliveryIntent — Pending intent to invoke when the message has been delivered (discussed in
more detail in the next section)
NOTE If you send an SMS message programmatically using the SmsManager class, the message sent will not appear in the built-in Messaging application of the sender.
No comments:
Post a Comment