我有一个问题,我正在试图将一个mp3文件发送到gmail。
到目前为止,我的代码在whatsapp,hotmail,蓝牙方面运行良好...但它不适用于gmail
这是我的代码:
File sdCard = Environment.getExternalStorageDirectory();
String path = sdCard.getAbsolutePath() + "/" +"miApp"+"/tono.mp3";
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("audio/mp3");
intent.putExtra(Intent.EXTRA_SUBJECT, "Asunto");
intent.putExtra(Intent.EXTRA_TEXT, "Prueba");
intent.putExtra(Intent.EXTRA_STREAM,Uri.parse("file:///" + path));
startActivity(intent);
我尝试使用各种类型的mime但结果相同
怎么了?
答案 0 :(得分:0)
这对我有用
Intent i = new Intent(Intent.ACTION_SEND);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.setType("audio/mp3");
i.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///sdcard/miApp/tono.mp3"));
startActivity(i);