dlt.systemShare
Introduction
This API allows you to use the Android system's sharing capabilities. It provides the ability to share content through various channels supported by the system. This API is only open to internal use.
Usage Limitations
This feature is supported from the base library version 3.0.0
or higher.
Parameters
Object object
Property | Type | Default | Required | Description |
---|---|---|---|---|
shareContent | string | No | The text content to be shared | |
shareFilePath | string | No | The file path of the content to be shared (image, video, file) | |
success | function | No | Callback function when the interface is successfully called | |
fail | function | No | Callback function when the interface call fails | |
complete | function | No | Callback function when the interface call ends (executed whether successful or failed) |
Note: Either one of the two parameters is required. If both shareFilePath
and shareContent
are not empty, priority will be given to shareFilePath
. If the file is found, it will be shared. If the file is not found, the text content will be shared.
object.success callback function
Parameters
Object res
Property | Type | Description |
---|---|---|
success | string | true - Setting success |
object.fail callback function
Parameters
Object res
Property | Type | Description |
---|---|---|
success | string | false-failed |
errMsg | string | Error message: 1. Parameter error: S10001 2. Share File Failed, no write permission: S10002 3. ShareContent is empty: S10003 4. Share Failed: S10004 |
Sample Code
// pages/index/index.js
Page({
share() {
dlt.systemShare({
shareContent: 'hello world',
shareFilePath: 'images/xxx.png'
});
},
});