mail-archives/monodroid/2012-November/012997.html

121 строка
4.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE> [mono-android] Send Email with Attachment - changes between ICS and JB?
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:monodroid%40lists.ximian.com?Subject=Re%3A%20%5Bmono-android%5D%20Send%20Email%20with%20Attachment%20-%20changes%20between%20ICS%20and%0A%09JB%3F&In-Reply-To=%3C1354197990353-5712532.post%40n5.nabble.com%3E">
<META NAME="robots" CONTENT="index,nofollow">
<style type="text/css">
pre {
white-space: pre-wrap; /* css-2.1, curent FF, Opera, Safari */
}
</style>
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="013018.html">
<LINK REL="Next" HREF="013001.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[mono-android] Send Email with Attachment - changes between ICS and JB?</H1>
<B>Stephan Steiner</B>
<A HREF="mailto:monodroid%40lists.ximian.com?Subject=Re%3A%20%5Bmono-android%5D%20Send%20Email%20with%20Attachment%20-%20changes%20between%20ICS%20and%0A%09JB%3F&In-Reply-To=%3C1354197990353-5712532.post%40n5.nabble.com%3E"
TITLE="[mono-android] Send Email with Attachment - changes between ICS and JB?">stephan.steiner at gmail.com
</A><BR>
<I>Thu Nov 29 14:06:30 UTC 2012</I>
<P><UL>
<LI>Previous message: <A HREF="013018.html">[mono-android] Mono Lost License 4.4.38
</A></li>
<LI>Next message: <A HREF="013001.html">[mono-android] No resource found for Color
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#12997">[ date ]</a>
<a href="thread.html#12997">[ thread ]</a>
<a href="subject.html#12997">[ subject ]</a>
<a href="author.html#12997">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>Hi
I'm using the following code to send emails with multiple attachments using
M4A (should be easily transferable to Java):
Intent intent = new Intent(Intent.ActionSendMultiple);
intent.SetType(&quot;text/plain&quot;);
intent.PutExtra(Intent.ExtraText, &quot;Mail body&quot;);
intent.PutExtra(Intent.ExtraSubject, &quot;Mail subject&quot;);
DirectoryInfo di = new
DirectoryInfo(Android.App.Application.Context.FilesDir.AbsolutePath);
List&lt;Android.Net.Uri&gt; fileList = new
List&lt;Android.Net.Uri&gt;();
foreach (FileInfo file in di.GetFiles(&quot;MyAppLogFile*&quot;))
{
Java.IO.File myFile = new
Java.IO.File(file.FullName);
var uri = Android.Net.Uri.FromFile(myFile);
fileList.Add(uri);
}
if (fileList.Count &gt; 0)
intent.PutParcelableArrayListExtra(Intent.ExtraStream, fileList.ToArray());
StartActivity(Intent.CreateChooser(intent, &quot;Send
email&quot;));
This worked fine on ICS devices, but on Jelly Bean, the mail programm still
shows the attachments, but they are not being sent. Since the files come
from within the protected part of the file system belonging to the app, I
suspect that something may have changed with the permission system from ICS
(tried on a Galaxy S3) and JB (tried on a Galaxy S3 and Galaxy Nexus - the
latter running JB 4.2).
Has anybody successfully managed to send emails with attachments on JB where
the files to be sent are located in the application directory or a
subdirectory thereof?
Thanks
Stephan
--
View this message in context: <A HREF="http://mono-for-android.1047100.n5.nabble.com/Send-Email-with-Attachment-changes-between-ICS-and-JB-tp5712532.html">http://mono-for-android.1047100.n5.nabble.com/Send-Email-with-Attachment-changes-between-ICS-and-JB-tp5712532.html</A>
Sent from the Mono for Android mailing list archive at Nabble.com.
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="013018.html">[mono-android] Mono Lost License 4.4.38
</A></li>
<LI>Next message: <A HREF="013001.html">[mono-android] No resource found for Color
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#12997">[ date ]</a>
<a href="thread.html#12997">[ thread ]</a>
<a href="subject.html#12997">[ subject ]</a>
<a href="author.html#12997">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/monodroid">More information about the Monodroid
mailing list</a><br>
</body></html>