Android Question Sharing to a specific set of apps

Alessandro71

Well-Known Member
Licensed User
Longtime User
This is the code I use to share a zip file as an email attachment

B4X:
Dim email As Email
email.To.Add(m_EmailAddress)
email.Subject = Subject
email.Body = Body
'copy the file to the shared folder
File.Copy(Starter.privateDir, FileName, Starter.Provider.SharedFolder, FileName)
email.Attachments.Add(Starter.Provider.GetFileUri(FileName))
Dim in As Intent = email.GetIntent
in.Flags = 1 'FLAG_GRANT_READ_URI_PERMISSION
StartActivity(in)

StartActivity opens a share dialog with all kind of apps: Gmail, Facebook, Drive, Outlook, Chrome... and is up to the user to select the correct one.
Is there a way to limit the list of app the OS shows?
Ideally I'd limit the list to email apps (primarily Gmail) and also Drive (because if the zip attachment is too big, the user may share it via Drive)
 

zed

Active Member
Licensed User
If the system identifies multiple activities capable of handling the intent, it displays a dialog box that allows the user to select which application to use.
If only one activity handles the intent, the system launches it immediately.
Is there a way to limit the list of app the OS shows?
I don't think it's possible.
But user can still select "Always open with"
 
Upvote 0

Alessandro71

Well-Known Member
Licensed User
Longtime User
But user can still select "Always open with"
that's part of the problem: some users choose "always open" and then they complain about being unable to select another app.
but that's an Android user interface issue...
 
Upvote 0
Top