Android Question Can't send email, Android wants to use chat instead [solved]

Didier9

Well-Known Member
Licensed User
Longtime User
I am not sure when that started, a couple of months ago maybe. I was not paying attention but now I really need this to work.
I am using an email intent to send a csv copy of a Sqlite database to myself via email for backup/processing on thePC (my tax return, 3 businesses and 4 rentals...)
That no longer works, it seems Android is hellbent on using chat instead of email, but the csv attachment is not forwarded via chat.
I googled it but did not find any useful reference.
I can't believe I would be the first one to come across that.
Thank you A LOT in advance for any help.
 

Star-Dust

Expert
Licensed User
Longtime User
Need some technical info. The code how you send files is also where the files are stored. Maybe post a small example of emailing a simple cvs file. Specify the Android version.
 
Upvote 0

Didier9

Well-Known Member
Licensed User
Longtime User
I thought I had fixed it...
I used an older phone (with Android 14) which showed the same problem, to check my code, and the fix below fixed it on that phone.
It seems to be the result of Android now integrating chat with gmail.
I found that I had to add an action to the intent, as follows:

B4X:
Private ei As Email ' requires Phone library
Sub SendEmail( email as String, FileName as string )
    ei.To.Add( email )
    ei.Body = FileName & " is attached."
    ei.Subject = FileName
    ei.Attachments.Add( Starter.Provider.GetFileUri( FileName ))
    Dim in As Intent = ei.GetIntent
    in.Flags = 1 ' FLAG_GRANT_READ_URI_PERMISSION
    in.Action = in.ACTION_SEND ' <===== new statement
    StartActivity( in )
Ens Sub

But that does not work on my Pixel 7 with Android 15 :( (It still goes to chat with no option to select gmail instead)
 
Upvote 0

Didier9

Well-Known Member
Licensed User
Longtime User
Ok, I fixed it for good now (at least for now).
I had chat enabled for one of the email accounts I was using. The fix above and checking off Chat in the email account fixed it.

I have two gmail accounts, and I routinely send email attachments from one email to the other for backup (I then pick them up on the PC for storage or processing).
Apparently if at least one of the accounts has Chat enabled, any email from one account to the other account results in the message going through chat, and no attachment.
 
Upvote 0

Didier9

Well-Known Member
Licensed User
Longtime User
Need some technical info. The code how you send files is also where the files are stored. Maybe post a small example of emailing a simple cvs file. Specify the Android version.
Thanks for the quick comeback anyways, I was freaking out for a bit...
 
Upvote 0
Top