I am using "SMS Intent" to send the SMS, I am not able to exit the SMS screen after successful completion of the SMS. here is the source code.
//Sending SMS to multiple phone numbers
public void sendSms(Context context, String text, String numbers) {
Uri uri = Uri.parse("sms:" + numbers)
Intent intent = new Intent();
intent.setData(uri);
intent.putExtra(Intent.EXTRA_TEXT, text);
intent.putExtra("sms_body", text);
intent.putExtra("address", numbers);
intent.putExtra("exit_on_sent", true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
intent.setAction(Intent.ACTION_SENDTO);
String defaultSmsPackageName = Telephony.Sms.getDefaultSmsPackage(context);
if (defaultSmsPackageName != null) {
intent.setPackage(defaultSmsPackageName);
}
} else {
intent.setAction(Intent.ACTION_VIEW);
intent.setType("vnd.android-dir/mms-sms");
}
try {
context.startActivity(intent);
} catch (ActivityNotFoundException e) {
e.printStackTrace();
}
}
How can I close the SMS activity/screen? Can anyone help me to resolve this issue?