本文档旨在帮助开发者配置其网页或APP,以实现一键跳转至伯索云学堂及其定制化APP的特定页面的功能。
一、 配置说明#
我们已预先配置了用于接收外部跳转的链接协议。您需要根据您的平台(网页或App)按照下方的示例代码进行集成。1. 统一资源标识符 (URI Scheme)#
scheme://host/path?type=queryplaso://plaso/liveclass?type=list组成部分 | 说明 | 示例 |
---|
Scheme(必需) | 应用协议头 | plaso,如果为客户化机构,则为yxt+机构简称,如爱问云:yxtai |
Host(必需) | 操作指令 | plaso或ai(根据机构类型) |
Path | 路径 | liveclass |
Query | 参数 | ?type=list |
2. 支持的页面类型 (page_type)#
页面 | 功能描述 | 示例 |
---|
实时课堂 | 实时课堂/历史课堂列表页 | plaso://plaso/liveclass?type=list |
二、 集成指南#
1. Android 示例#
1.1 网页跳转#
<!DOCTYPE html>
<html>
<head>
<title>跳转到伯索云学堂</title>
</head>
<body>
<a href="plaso://plaso/liveclass?type=list">打开伯索云学堂</a>
</body>
</html>
1.2 原生APP跳转#
private fun launchAppBByDeepLink1() {
try {
val deepLinkIntent = Intent().apply {
action = Intent.ACTION_VIEW
data = Uri.parse("plaso://plaso/liveclass?type=list")
}
startActivity(deepLinkIntent)
} catch (e: Exception) {
Toast.makeText(this, "无法处理该链接", Toast.LENGTH_SHORT).show()
e.printStackTrace()
}
}
2. iOS 示例#
/// 查询是否可以打开App
/// 需要在 Info.plist 中配置 LSApplicationQueriesSchemes (plaso)
func canLaunchApp() {
let url = URL(string: "plaso://plaso/liveclass?type=list")
let canOpen = UIApplication.shared.canOpenURL(url!)
print("canOpen \(url!.absoluteString): \(canOpen)")
}
/// 打开app
func launchApp() {
let url = URL(string: "plaso://plaso/liveclass?type=list")
UIApplication.shared.open(url!, options: [:], completionHandler: { success in
print("Open \(url!.absoluteString): \(success)")
})
}