To launch default SMS app with text and number populated and launch phone call dialer pad with the number given, use the corresponding code snippet from below jist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This just opens the default SMS app with To filled with contact of given phoneNumber and textBody filled into the text to be sent text box | |
public void openSMSApp (Context context, String phoneNumber, String text){ | |
Uri smsUri = Uri.fromParts("sms", phoneNumber, null); | |
Intent intent = new Intent(Intent.ACTION_VIEW, smsUri); | |
intent.putExtra("sms_body", text); | |
context.startActivity(intent); | |
} | |
//This just opens the dialer with given phone number filled into the dialer | |
public void openPhoneCallApp (Context context, String phoneNumber){ | |
Uri callUri = Uri.fromParts("tel", phoneNumber, null); | |
Intent intent = new Intent(Intent.ACTION_VIEW, callUri); | |
context.startActivity(intent); | |
} |