我试图在Android中使用意图发送文件。我启动了一个意图选择器并选择了GMail应用程序。问题是我无法设置我的自定义MIME类型,它总是成为应用程序/八位字节流。 (?也许老版本的Android,像预JB)在GMail应用程序中忽略自定义MIME类型
在旧版本的Gmail应用的它工作得很好做这样的:
Intent sendIntent = new Intent(Intent.ACTION_SEND);
// Add attributes to the intent
sendIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Send my file");
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(path));
sendIntent.setType("application/vnd.mycustommimetype");
context.startActivity(Intent.createChooser(sendIntent, context.getString(R.string.lblShare)));
有谁知道如何设置MIME类型一起工作更高版本的GMail/Android?
索姆试错后,我见,在Gmail应用程序版本4这个工作得很好,但在GMail的4.2版是不可能设置MIME类型,或者它以另一种方式来完成。任何人都知道? :/
我有同样的问题。你找到了解决方案吗? – pstoppani
Android 5.0中仍然存在问题 –