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:
Property | Type | Required | Default | Description |
---|---|---|---|---|
shareContent | String | Yes/No | Text content to share | |
shareFilePath | String | Yes/No | Path 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
Property | Type | Description |
---|---|---|
success | String | Describes whether the interface call was successful or not. "true" for success, "false" for failure |
Fail Callback Function
Parameters
Object res
Property | Type | Description |
---|---|---|
success | String | Describes whether the interface call was successful or not. "true" for success, "false" for failure |
errMsg | String | Error 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);
},
});
}