Attached audio file as a mms in android

最后都变了- 提交于 2019-12-10 19:11:04

问题


I am develop one app that require record the voice.and that voice can be automatically attached to the mms.

i am useing this code

Intent sendIntent = new Intent(Intent.ACTION_SEND);  
                sendIntent.setClassName("com.android.mms", "com.android.mms.ui.ComposeMessageActivity");
                sendIntent.putExtra("address", "9999999999");
                sendIntent.putExtra("sms_body", "if you are sending text");   
                final File file1 = new File(Environment.getExternalStorageDirectory().getAbsolutePath(),"connection.amr");
                Uri uri = Uri.fromFile(file1);
                Log.e("Path", "" + uri);
                sendIntent.putExtra(Intent.EXTRA_STREAM, uri);
                sendIntent.setType("*/*");
                startActivity(sendIntent);

all of the going fine but file can't attached automatically.any idea about this??

When user click on send button that time automatically attached that file in particular number with subject and sms_body part that it.

My file Extension is .3gp

This code is perfect work in Samsung ace 5830i and Samsung Galaxy nexus but not work in Htc desire c,Htc one.

I am tested this setType.but not positive response.

  sendIntent.setType("video/3gp");
  sendIntent.setType("audio/*");
  sendIntent.setType("*/*");
  sendIntent.setType("audio/mp3");

If automatic attachement is possible or not?


回答1:


Try this:

Intent sendIntent = new Intent(Intent.ACTION_SEND); 
sendIntent.putExtra("text-body", "if you are sending text");    
sendIntent.putExtra("num", "number");

sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("ur file path"));
sendIntent.setType("audio/3gp");


来源:https://stackoverflow.com/questions/14101286/attached-audio-file-as-a-mms-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!