dlt.getUniqueId
Introduction
This function is used to obtain a unique identifier for the user, which can be used to identify the user's identity.
Usage Limitations
This function is supported in the basic library version 2.3.0 and later.
Note: The callback of this interface depends on network conditions. It is recommended to add timeout logic to avoid delayed callbacks when there are network fluctuations, which can impact user experience.
Parameters
Object object
Property | Type | Default | Required | Description |
---|---|---|---|---|
success | function | No | Callback function for a successful interface call | |
fail | function | No | Callback function for a failed interface call | |
complete | function | No | Callback function for the end of an interface call (executed whether the call is successful or failed) |
object.success Callback Function
Parameters
Object res
Property | Type | Description |
---|---|---|
success | string | true - Successful retrieval |
uniqueId | string | The unique identifier |
object.fail Callback Function
Parameters
Object res
Property | Type | Description |
---|---|---|
success | string | false - Retrieval failed |
Sample Code
// pages/index/index.js
Page({
getUniqueId() {
dlt.getUniqueId({
success:function(res){
console.log("get uniqueId": res.uniqueId)
}
});
},
});