When I have the contact id, how do I send an SMS/email (aka text) to it?
I’ve seen code like this, but none are using the contact it.
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, text);
act.startActivityForResult(Intent.createChooser(intent, ""), 0);
If you wish to send the text message directly from your app instead of throwing the intent, you can use
sendTextMessage()in android.telephony.SmsManager, see the docs here. That does mean a small annoyance for your user, as well as requiring the permission in the manifest.To do what you are doing above with the phone number filled in, you have to include:
intent.putExtra("address", "07910123456");Thus, the completed code is: