I successfully opened gmail with prepopulated content and a file
attachment, it worked when I send it but this file was stored on the
SDCard.
Now I am trying to do the same with a shared application file (with
MODE_WORLD_READABLE) but gmail drops the attachment at sending time
although I saw it in the mail screen.
My code:
String fileName = "test.txt";
openFileOutput(fileName, MODE_WORLD_READABLE |
MODE_WORLD_WRITEABLE);
File file = getFileStreamPath(fileName);
FileWriter writer = new FileWriter(file);
for (int i = 0; i < 4000; i++)
writer.write("test\n");
writer.close();
Log.e("tmp", "size=" + file.length());
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("text/plain");
sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[]
{ "[email protected]" });
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "subject");
startActivity(Intent.createChooser(sendIntent, "send a file by
mail"));
I also tested MODE_WORLD_READABLE alone but I know gmail truncate to
102 KB so it's why I also tried to add MODE_WORLD_WRITEABLE but none
of the two solutions seem to work...
I tested on the G1, but if I test on emulator, altough there is no
gmail, I checked with adb shell that the file has read/write
permissions to "others" and I checked the content of the file, the
file is OK.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---