Bug 24430 - Adding attachment to email fails
Summary: Adding attachment to email fails
Status: CONFIRMED
Alias: None
Product: Android
Classification: Xamarin
Component: General (show other bugs)
Version: 4.20.0
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2014-11-11 04:07 UTC by ursling
Modified: 2014-11-11 08:27 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Sample App (13.17 KB, application/zip)
2014-11-11 08:26 UTC, Udham Singh
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 24430 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description ursling 2014-11-11 04:07:03 UTC
Hi

Until a couple of days ago, I was able to attache a screenshot as an attachment to an android email with is stated as an activity from within the app. However, since upgrading the Google Mail app, I now get this toast "Permission denied for the attachment", as the email opens up
 The code executes without causing an exception: This is the basic code to attach and create the email:

var file = new Java.IO.File (ScreenShot);
					file.SetReadable(true, false);
					var uri =  Android.Net.Uri.FromFile (file);


					var email = new Intent(Intent.ActionSend);
					email.SetType("message/rfc822");
					email.PutExtra(Intent.ExtraSubject, Subject);
					email.PutExtra(Intent.ExtraText, Body);
					email.PutExtra(Intent.ExtraStream, uri);
					email.AddFlags(ActivityFlags.GrantReadUriPermission);

					try {
						StartActivity(email);
					}
					catch {
						Log.Error("From: Share Info", "Share info email failed");
					}
				}

where Screenshot , Subject and Body are strings

These are the email permissions in my Manifest file:

      <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
	<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
	 <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
  	 <uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
  	<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
   	<uses-permission android:name="com.android.email.permission.ACCESS_PROVIDER" /> 
   	 <permission android:name="com.android.email.permission.ACCESS_PROVIDER" android:protectionLevel="signatureOrSystem" />
 	<permission android:name="com.android.email.permission.READ_ATTACHMENT" android:permissionGroup="android.permission-          group.MESSAGES" android:protectionLevel="dangerous" />
    <uses-permission android:name="com.android.email.permission.READ_ATTACHMENT"/>
	<uses-permission android:name="com.google.android.gm.permission.READ_ATTACHMENT_PREVIEW" />

Kind Regards

Amanda
Comment 1 Udham Singh 2014-11-11 06:41:46 UTC
Hi,

We have tried to reproduce this issue but not able to reproduce this. Could you please provide a sample app/test case/detailed steps that demonstrate this issue, so that we can reproduce this issue at our end.

Also please include you complete build info. You can get build info via 'Xamarin Studio ->About Xamarin Studio ->Show Details ->Copy Info and paste it '.

Thanks
Comment 2 ursling 2014-11-11 06:46:39 UTC
Hi 
=== Xamarin Studio ===

Version 5.6.2 (build 5)
Installation UUID: daee6a46-83ce-435b-aa8f-3e62a60d670a
Runtime:
	Mono 3.10.0 ((detached/633e444)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 310000020

=== Xamarin.Android ===

Version: 4.18.1 (Business Edition)
Android SDK: /Users/amandaadams/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.1    (API level 7)
		2.2    (API level 8)
		2.3    (API level 10)
		3.0    (API level 11)
		3.1    (API level 12)
		3.2    (API level 13)
		4.0    (API level 14)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		4.5    (API level 21)
Java SDK: /usr
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)

=== Apple Developer Tools ===

Xcode 6.1 (6604)
Build 6A1052d

=== Xamarin.iOS ===

Version: 8.4.0.16 (Business Edition)
Hash: 80e9ff7
Branch: 
Build date: 2014-10-22 15:09:12-0400

=== Xamarin.Mac ===

Version:

=== Build Information ===

Release ID: 506020005
Git revision: 19bc3b64b70332bfab18faf9cf1ce7d3aa191b36
Build date: 2014-10-17 14:49:01-04

=== Operating System ===

Mac OS X 10.10.0
Darwin amandas-imac-2.africa.domain.local 14.0.0 Darwin Kernel Version 14.0.0
    Fri Sep 19 00:26:44 PDT 2014
    root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64

Have you upgraded your Google Mail app on your Android device  in the last day? This issue started only after upgrading. We are using various Android devices, and this issue only appears after this recent upgrade only on those devices that have upgraded. It still works on devices that have not upgraded their Google Mail

Regards
Comment 3 ursling 2014-11-11 08:14:51 UTC
Hi Some more info

I am now choosing the mail client before sending the email (StartActivity(Intent.CreateChooser(email, "Choose an Email client :"));

If I choose the default Samsung email app, I can attach my screenshot successfully. It only has a problem when using the latest Gmail app. I have tested this on an Android 4.3 and 4.4.

Regards

Amanda
Comment 4 Udham Singh 2014-11-11 08:26:06 UTC
Created attachment 8690 [details]
Sample App

I have checked this issue with the latest Google Mail app on Android device and observed that an attachment is getting added in email but when I try to open the attachment on android device then it does not open. Also attachment does not appear  for the recipient in his received email. 

I am attaching the sample app which I have created to reproduce this issue. 

Device Info :

Samsung Galaxy S2 (Android 2.3.3)
Sumsung Note (Android 4.4.2)

Please let me know if I can provide any other info/log to diagnose this issue.

Environment Info :

=== Xamarin Studio ===

Version 5.5.3 (build 6)
Installation UUID: ce927b2a-2c07-44c5-b186-09cfdafba6dc
Runtime:
	Mono 3.10.0 ((detached/e204655)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 310000023

=== Xamarin.Android ===

Version: 4.18.1 (Enterprise Edition)
Android SDK: /Users/xamarin76/Desktop/android-sdk-macosx
	Supported Android versions:
		1.6    (API level 4)
		2.1    (API level 7)
		2.2    (API level 8)
		2.3    (API level 10)
		3.0    (API level 11)
		3.1    (API level 12)
		3.2    (API level 13)
		4.0    (API level 14)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		4.5    (API level 21)
Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Apple Developer Tools ===

Xcode 6.0.1 (6528)
Build 6A317

=== Xamarin.Mac ===

Version: 1.10.0.18 (Enterprise Edition)

=== Xamarin.iOS ===

Version: 8.4.0.16 (Enterprise Edition)
Hash: 80e9ff7
Branch: 
Build date: 2014-10-22 15:09:12-0400

=== Build Information ===

Release ID: 505030006
Git revision: fbe3e9453daf6a3bb9a9709ed22bec35f7c9056b
Build date: 2014-10-23 13:08:38-04
Xamarin addins: e44add2b39de4dd57c0742bb2e620dfad84c64c6

=== Operating System ===

Mac OS X 10.9.4
Darwin Xamarin76s-Mac-mini.local 13.3.0 Darwin Kernel Version 13.3.0
    Tue Jun  3 21:27:35 PDT 2014
    root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64
Comment 5 Udham Singh 2014-11-11 08:27:21 UTC
As per comment 4, changing it's status to confirmed.