I have been using the capability to start an email and attach a file to it for some time. The original post I used was:
My logic using the methods in the forum entry is:
The logic originally immediately fired my android email app and allowed me to add more addresses or touch the arrow at the top right to send the email.
Some time ago, I noticed that a 'choice' box now appears at the bottom of the screen essentially asking what method I want to choose to 'share' my info. The box included 'EMail', 'gmail', 'drive', 'bluetooth', 'nearby share', 'Samsung Cloud Drive', 'Skype', 'Wifi Direct'. I always choose 'email' and the program proceeds as it used to.
My question is: "Is there any way to modify my 'call' to the email to avoid this 'choice' box. It might be an option on the in.flags.
As an alternative "Is there some choice in android setup to eliminate the extra step". The disadvantage of this is that the user would have to make that change.
Thanks, Cliff McKibbin
Sending an attachment by email
Hi. I am trying to send a file as an attachment by email from within my app, using an email application already on the phone (ie not just by SMTP directly from within the app). In my case I am using gmail. gmail gives an error 'permission denied for the attachment'. Any ideas how to solve...
www.b4x.com
My logic using the methods in the forum entry is:
B4X:
Sub btSend_Click
Dim email As Email
' setup email body message
s = "This file was sent to you from the " & Starter.AppName & " App by" & starter.ssyname & CRLF
S=s & "This is a file of one of your listings." & CRLF
S=s & "You can double click it and print all or part of it or save it as you wish."
Dim FileName1 As String = Starter.FS92File
'copy the file to the shared folder
File.Copy(File.Dirinternal, FileName1, Starter.Provider.SharedFolder, FileName1)
' build the email message
email.To.Add(txEmail.Text)
email.Subject = "Listing from the " & Starter.AppName & " App"
email.Body=s
email.Attachments.Add(Starter.Provider.GetFileUri(FileName1))
Dim in As Intent = email.GetIntent
in.Flags = 1 'FLAG_GRANT_READ_URI_PERMISSION
StartActivity(in)
End Sub
The logic originally immediately fired my android email app and allowed me to add more addresses or touch the arrow at the top right to send the email.
Some time ago, I noticed that a 'choice' box now appears at the bottom of the screen essentially asking what method I want to choose to 'share' my info. The box included 'EMail', 'gmail', 'drive', 'bluetooth', 'nearby share', 'Samsung Cloud Drive', 'Skype', 'Wifi Direct'. I always choose 'email' and the program proceeds as it used to.
My question is: "Is there any way to modify my 'call' to the email to avoid this 'choice' box. It might be an option on the in.flags.
As an alternative "Is there some choice in android setup to eliminate the extra step". The disadvantage of this is that the user would have to make that change.
Thanks, Cliff McKibbin