Sharing
Last Updated On 2021-07-16
Version 1MinSDK 7Tutorial Video
Sharing is a non-visible component that enables sharing files and/or messages between your app and other apps installed on a device. The component will display a list of the installed apps that can handle the information provided, and will allow the user to choose one to share the content with, for instance a mail app, a social network app, a texting app, and so on.
The file path can be taken directly from other components such as the Camera or the ImagePicker, but can also be specified directly to read from storage. Be aware that different devices treat storage differently, so a few things to try if, for instance, you have a file called arrow.gif in the folder Appinventor/assets
, would be:
"file:///sdcard/Appinventor/assets/arrow.gif"
or "/storage/Appinventor/assets/arrow.gif"
Properties
You can set the below properties in the UI part of the builder.
- PackageName - it's a text value which is set to blank by default.
Block Properties
You can set the below blocks properties in the blocks section of the builder.
PackageName
Set Package Name
Methods
You can set the below method blocks in the blocks section of the builder.
ShareFile
Shares a file through any capable application installed on the phone by displaying a list of the available apps and allowing the user to choose one from the list. The selected app will open with the file inserted on it.
ShareFileWithMessage
Shares both a file and a message through any capable application installed on the phone by displaying a list of available apps and allowing the user to choose one from the list. The selected app will open with the file and message inserted on it.
ShareMessage
Shares a message through any capable application installed on the phone by displaying a list of the available apps and allowing the user to choose one from the list. The selected app will open with the message inserted on it.