For sending SMS in Android, we have two different ways to do so, First is by using Android's built in SMS application and other is by using Android's SMS manager Api.
Here is how we do that:
1: By using Android device's built-in SMS application:
Intent smsIntent = new Intent(Intent.ACTION_VIEW);
smsIntent.putExtra("sms_body", "default content");
smsIntent.setType("vnd.android-dir/mms-sms");
startActivity(smsIntent);
2: By using Android'd SmsManager Api:
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage("phone_number", null, "message content goes here", null, null);
To send SMS in Android, we also need to a permission in AndroidManifest.xml, that is:
android:name="android.permission.SEND_SMS"
Hope these simple steps help you :)
0 Comment(s)