Android Question Limit sharing to email apps only

Alessandro71

Active Member
Licensed User
I'm composing an email with the following code, but the StartActivity allows the user to choose from all apps (including Drive, Whatsapp, etc)
Is there a way to limit the user to choose only valid email apps (eg: GMail, Yahoo Mail, Outlook, etc)?

B4X:
    Dim email As Email
    email.To.Add(m_EmailAddress)
    email.Subject = Subject
    email.Body = Body
    email.Attachments.Add(Starter.Provider.GetFileUri(FileName))
    Dim in As Intent = email.GetIntent
    in.Flags = 1 'FLAG_GRANT_READ_URI_PERMISSION
    StartActivity(in)
 

Alessandro71

Active Member
Licensed User
Not really. It will create a different type of intent if there are no attachments or there are 2+ attachments. You can try it and see if the results are better.
with 2 attachments, the list of apps is greatly reduced, but still not limited to email (Whatsapp and Linkedin are still present for example)
 
Upvote 0
Top