my.isCollected
Use the my.isCollected API to obtain the collection status of a mini program, which indicates whether a mini program is collected.
Note: To use this API, make sure to use the Appx with 1.17.0 or higher versions.
Sample Code
my.isCollected({
  success: (res) => {
    my.alert({
      content: 'Mini program is collected:' + JSON.stringify(res)
    });
  },
  fail: (res) => {
    my.alert({
      content: JSON.stringify(res)
    });
  }
});Parameters
| Property | Type | Required | Description | 
| 
 | Function | No | The callback function for a successful API call | 
| 
 | Function | No | The callback function for a failed API call | 
| 
 | Function | No | The callback function used when the API call is completed. This function is always executed no matter the call succeeds or fails. | 
Success Callback Function
The data type of the incoming parameter is Object with the following properties:
| Property | Type | Description | 
| 
 | Boolean | Indicates whether the current mini program is collected. Valid values: 
 | 
Error Codes
| Error Code | Error Message | Further action | 
| -1 | Unknown collection status | The collection status is unknown due to the mini program is not added to favorite list. Try to add the mini program into favorite list first. |