HomeDocs
Skip to main content

Use Android System Share

The API is a shareable API that can be used with the Android operating system. The specific channels that can be shared are equivalent to the capabilities of the system. This API is only open to internal use.

methodName: systemShare

Additional Parameters:

PropertyTypeRequiredDefaultDescription
shareContentStringYes/NoText content to share
shareFilePathStringYes/NoPath to the file to share (local path: image, video, or file)

⚠️ Note: You must provide at least one of the shareContent or shareFilePath parameters. If both are provided, shareFilePath takes precedence. For example, if both shareFilePath and shareContent are provided and the file is found, the file will be shared; otherwise, the text content will be shared.

Success Callback Function

Parameters

Object res

PropertyTypeDescription
successStringDescribes whether the interface call was successful or not. "true" for success, "false" for failure

Fail Callback Function

Parameters

Object res

PropertyTypeDescription
successStringDescribes whether the interface call was successful or not. "true" for success, "false" for failure
errMsgStringError message
Possible errMsg values:
1. Parameter error: S10001
2. Share File Failed, no write permission: S10002
3. ShareContent is empty: S10003
4. Share Failed: S10004

Example Usage

const dlt = window['@transsion/byteh5bridge'];
const canCallDlt = dlt && window.dltms && window.dltms.isMiniShellGame();

if (canCallDlt) {
dlt.callApi('systemShare', {
shareContent: 'Share this text',
success: (res) => {
console.log('Success: ', res);
},
fail: (res) => {
console.log('Fail: ', res);
},
complete: (res) => {
console.log('Complete: ', res);
},
});
}
Privacy agreementDeveloper agreementcontact us: developer_service.mi@transsion.com © 2024 MiniApp. All Rights Reserved.