Send MMS from My application in android

后端 未结 2 1774
一个人的身影
一个人的身影 2021-02-05 09:19

I want to send MMS from my application to a specific number. I\'ve searched and found this code but I have no idea if this code what I need or not. My Questions is :

-c

2条回答
  •  旧巷少年郎
    2021-02-05 09:42

    why don't you use the android system functions:

    Please have a look on

    https://developer.android.com/guide/components/intents-common.html

    public void composeMmsMessage(String message, Uri attachment) {
           Intent intent = new Intent(Intent.ACTION_SEND);
           intent.setData(Uri.parse("smsto:"));  // This ensures only SMS apps respond
           intent.putExtra("sms_body", message);
           intent.putExtra(Intent.EXTRA_STREAM, attachment);
           if (intent.resolveActivity(getPackageManager()) != null) {
               startActivity(intent); }
    }
    

    Cheers

    Tom

提交回复
热议问题