2011-03-06 100 views
3

使用下面的代碼通過電子郵件發送音頻文件,dropbox +++ .. 這不給我通過MMS發送相同文件的選項.. 任何人都知道如何將其附加到彩信並讓用戶發送,如果他/她想要?Android - 用MMS發送音頻文件

 Intent share = new Intent(Intent.ACTION_SEND); 
     share.setType("audio/3gpp"); 
     share.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + aFile)); 
     startActivity(Intent.createChooser(share, "Send file")); 
+0

我在做類似的事情! http://stackoverflow.com/questions/14452808/sending-and-receiving-mms-in-android – toobsco42 2013-01-22 06:42:04

回答

0

您可以使用此代碼..

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(),"Downloadtest.3gp"); 
      Uri uri = Uri.fromFile(file1); 

      sendIntent.putExtra(Intent.EXTRA_STREAM, uri); 
      sendIntent.setType("video/3gp"); 
      startActivity(Intent.createChooser(sendIntent, "Send file")); 

,你必須用你的適當的一組類型。如果音頻然後音頻/ *,圖像,然後圖像/ PNG

此代碼工作我的三星nexus,王牌5830,但不工作htc amaze.If任何人發現任何解決方案,然後請給出片段。