An app can create an ACTION_SEND Intent to share a file and/or text to another app. This Intent can provide an InputStream to get the actual file via EXTRA_STREAM. This Intent can also include EXTRA_TEXT to describe what the shared file is. Apps like K-9Mail, Gmail, Signal, etc. correctly handle this case and include both the file itself and the related text in the draft message. Element only attaches the file and ignores the text.
This is used in F-Droid to share apps. The text is the name/description of the app and the URL that points to the app's page on f-droid.org. The EXTRA_STREAM is the actual APK if available. Having all together means that the user can choose to share a message or the actual APK, depending on the receiving app.
To Reproduce
Create an Intent and open the Share chooser.
Select Element
Here's the code for creating the Share chooser:
Intent intent = new Intent(Intent.ACTION_SEND);
Uri streamUri = getUri(context, packageName); // points to ContentProvider in F-Droid
// the streamUri could be any file that's easy to include, e.g. an image
intent.setType("application/zip");
intent.putExtra(Intent.EXTRA_STREAM, streamUri);
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.putExtra(Intent.EXTRA_SUBJECT, "Shared from F-Droid: " + app.name + ".apk");
intent.putExtra(Intent.EXTRA_TITLE, app.name + ".apk");
String extraText = String.format("%s (%s)\nhttps://f-droid.org/packages/%s/",
app.name, app.summary, app.packageName);
intent.putExtra(Intent.EXTRA_TEXT, extraText);
Intent chooserIntent = Intent.createChooser(intent, getString(R.string.menu_share));
startActivity(chooserIntent);
This feature will also be included in F-Droid v1.14, go to Settings --> Manage installed apps --> Click on an app --> Click share.
Expected behavior
Should create a draft message with the text from EXTRA_TEXT with the data in EXTRA_STREAM there as an attachment.
I agree, this is not ideal. We should probably use the body to send the EXTRA_TEXT content, but currently there is no way to edit the body of an Event with a m.file attachment, and the spec recommends to use the filename here...
Describe the bug
An app can create an
ACTION_SEND Intent
to share a file and/or text to another app. ThisIntent
can provide anInputStream
to get the actual file viaEXTRA_STREAM
. ThisIntent
can also includeEXTRA_TEXT
to describe what the shared file is. Apps like K-9Mail, Gmail, Signal, etc. correctly handle this case and include both the file itself and the related text in the draft message. Element only attaches the file and ignores the text.This is used in F-Droid to share apps. The text is the name/description of the app and the URL that points to the app's page on f-droid.org. The
EXTRA_STREAM
is the actual APK if available. Having all together means that the user can choose to share a message or the actual APK, depending on the receiving app.To Reproduce
Intent
and open the Share chooser.Here's the code for creating the Share chooser:
This feature will also be included in F-Droid v1.14, go to Settings --> Manage installed apps --> Click on an app --> Click share.
Expected behavior
Should create a draft message with the text from
EXTRA_TEXT
with the data inEXTRA_STREAM
there as an attachment.Screenshots
FYI @n8fr8
More info and discussion