创建短推荐人链接
注: 此功能在 SDK 3.1.8+ 版本中可用。
使用短链接可将冗长、充满参数的奇异链接转换为更短、更安全的链接,方便分享。
通常情况下,您需要动态创建短链接,以便应用程序的用户可以与朋友分享,邀请他们使用应用程序。
要创建短链接,您需要
使用createReferrerShortLink方法创建短链接,如下例所示。
Singular.createReferrerShortLink 方法
签名
Singular.createReferrerShortLink(singularLink, referrerName, referrerId, passthroughParams)
使用示例
Singular.createReferrerShortLink (
"https://sample.sng.link/B4tbm/v8fp?_dl=https%3A%2F%2Fabc.com",
"John Doe", // Referrer Name
"aq239897", // Referrer ID
{"channel": "sms"}, // Any parameters you want to add to the link
(shortLinkURL,error) => {
// Add your share logic here if shortLinkURL is not null.
// If there was an error, add logic to retry/abort/modify the
// params passed to the function, based on the cause of the error.
}
)