allowSystemSnapshot
The allowSystemSnapshot JSAPI is called by the my.call JSAPI, which allows or forbids the screenshots or screen recordings.
Prerequisites:
This JSAPI takes effect when the following conditions are met:
- For Android: 2.59.2 and the above versions
- For iOS: 2.59.0 and the above versions
- For iOS: only iOS 13 and above
Parameters
The incoming parameter is of the Object type with the following properties:
Property | Type | Required | Description |
allow | Boolean | No | It takes effect throughout the mini program except some setting pages (e.g. the about page, the settings page, the system pop-up window, and so on): Valid values:
|
success | Function | No | The callback function that is called upon successful call. |
fail | Function | No | The callback function that is called when the JSAPI call fails. When executed, it receives an Error codes object. |
complete | Function | No | The callback function that is called upon call completion (to be executed upon either successful or failed call). |
Error codes
Error code | Error message | Solution |
1 | Invalid JSAPI interface. | Please check whether your current runtime supports this JSAPI. |
2 | Invalid JSAPI entry parameters. | Refer to the Parameters table and check whether all parameter types are correct and whether all required parameters are specified. |
Sample code
my.call('allowSystemSnapshot',{
allow:true,
success:()=>{
console.log(res);
},
fail: (res) => {
console.log(err);
}
});