There are two ways to send sms in android
1.Using smsManager
2.Using Intent
1.Using smsManager
1.Using smsManager
2.Using Intent
1.Using smsManager
private void sendSMS(String phoneNumber, String message) { PendingIntent pi = PendingIntent.getActivity(this, 0,
new Intent(this, SMS.class), 0); SmsManager sms = SmsManager.getDefault(); sms.sendTextMessage(phoneNumber, null, message, pi, null); }
Add this permission in manifest file
<uses-permission android:name="android.permission.SEND_SMS">
2.Using Intent
Intent sendIntent = new Intent(Intent.ACTION_VIEW); sendIntent.putExtra("sms_body", "Content of the SMS goes here..."); sendIntent.setType("vnd.android-dir/mms-sms"); startActivity(sendIntent);
You can get more details from the following site
http://mobiforge.com/developing/story/sms-messaging-android
No comments:
Post a Comment