其中默使用类型,附加" .ZIP"在Gmail中的文件 [英] which mime type to use ,to attach ".zip" file in Gmail
问题描述
我有我需要附上对.zip文件,并使用Gmail服务发送的电子邮件的要求。
I have a requirement that I need to attach a ".zip" file and send the email using Gmail Service.
我使用下面code要做到这一点:
I am using below code to do this:
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType(application/x-compressed);
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{abc@gmail.com});
intent.putExtra(Intent.EXTRA_STREAM,
Uri.parse(abc.zip);
intent.putExtra(Intent.EXTRA_TEXT, "hello..");
如果我用的是应用程序/ x-COM pressedMIME类型,我可以发送.ZIP的附件,但我无法推出的Gmail作曲家直接,在此之前,它是提供的选项列表。
If I use the "application/x-compressed" mime type , I am able to send ".zip" attachments but I am unable launch Gmail composer directly, before that it is providing list of options.
如果我用信息/ RFC822MIME类型,我能够直接启动Gmail的作曲家,但无法附加.ZIP的文件。
If I use "message/rfc822" mime type, I am able to launch Gmail composer directly, but unable to attach ".zip" files.
PL。帮我如何在一个意图对象结合这两种MIME类型。 PL。让我知道,如果有任何替代做到这一点。 谢谢。
Pl. help me to how to combine these two mime types in a single intent object. Pl. let me know if there's any alternative to do this. thanks.
推荐答案
intent.setClassName(com.google.android.gm,com.google.android.gm.ComposeActivityGmail);
intent.setClassName("com.google.android.gm", "com.google.android.gm.ComposeActivityGmail");
直接打开Gmail的。然而,如果没有安装的Gmail就会引起例外,ActivityNotFound
to open Gmail directly. however if gmail is not installed it will cause exception, ActivityNotFound
这篇关于其中默使用类型,附加" .ZIP"在Gmail中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!