Android Question Attach a pdf to an email

BillMeyer

Well-Known Member
Licensed User
Longtime User
Good Day Brothers,

I have a problem attaching a pdf and sending it to a client via email intent. This is with Android 7. Previous versions I have no problems with.

Here is my code (lifted from elsewhere on the forum - thank you)

B4X:
File.Copy(path1, GlobFileName, Starter.shared, GlobFileName)
    Try
        Dim intent1 As Intent
        intent1.Initialize("android.intent.action.SEND", "mailto:example@outlook.com")
        intent1.putExtra("android.intent.extra.SUBJECT", "This is the subject")
        intent1.putExtra("android.intent.extra.TEXT", "This is the message body")
        intent1.putExtra("android.intent.extra.DEFAULT", "content://" & CreateFileProviderUri(Starter.shared, GlobFileName))
       
        StartActivity(intent1)
    Catch
        ToastMessageShow("No mail apps", True)
    End Try

I would appreciate it if someone could point my error - I just don't see it - possibly I'm tired at this stage.

Thank you
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
Top