傳送 SMS/MMS

//呼叫簡訊程式

Intent it = new Intent(Intent.ACTION_VIEW);

it.putExtra("sms_body", "The SMS text");

it.setType("vnd.android-dir/mms-sms");

startActivity(it);

//傳送簡訊

Uri uri = Uri.parse("smsto:0800000123");

Intent it = new Intent(Intent.ACTION_SENDTO, uri);

it.putExtra("sms_body", "The SMS text");

startActivity(it);

//傳送 MMS

Uri uri = Uri.parse("content://media/external/images/media/23");

Intent it = new Intent(Intent.ACTION_SEND);

it.putExtra("sms_body", "some text");

it.putExtra(Intent.EXTRA_STREAM, uri);

it.setType("image/png");

startActivity(it);

//如果是 HTC Sense 手機,你要用

Intent sendIntent = new Intent("android.intent.action.SEND_MSG");

sendIntent.putExtra("address", toText);

sendIntent.putExtra(Intent.EXTRA_SUBJECT, "subject");

sendIntent.putExtra("sms_body", textMessage);

sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(url));

sendIntent.setType("image/jpeg");

startActivity(sendIntent);

//底下這段更好,可在所有手機上用

//refer to http://stackoverflow.com/questions/2165516/sending-mms-into-different-android-devices

Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mmsto:<number>");

intent.putExtra("address", <number>);

intent.putExtra("subject", <subject>);

startActivity(intent);