如何深度链接跳转至Microsoft Azure Intelligent Hub的指定应用页面?
React Native跳转Intelligent Hub至指定应用详情页实现方案
Intelligent Hub支持的URL Scheme规则
Intelligent Hub内置了可直接跳转内部页面的URL Scheme能力,无需额外申请权限即可使用,规则如下:
- 标准Scheme协议头为
workspaceone://,针对v20.08之前的旧版本Hub,可使用兼容协议头airwatch:// - 跳转指定应用详情页的完整格式为:
workspaceone://apps/details?appid=<Hub后台应用唯一ID>
其中<Hub后台应用唯一ID>需替换为Workspace ONE UEM控制台中,对应待安装应用的内部唯一标识,不是应用的包名/Bundle ID。
React Native端配置&实现步骤
1. 配置Scheme访问白名单
- iOS端:打开项目ios目录下的Info.plist,在
LSApplicationQueriesSchemes数组节点下新增两个字符串值:workspaceone、airwatch - Android端:打开项目android/app/src/main目录下的AndroidManifest.xml,在manifest节点下新增queries配置:
<queries> <intent> <action android:name="android.intent.action.VIEW" /> <data android:scheme="workspaceone" /> </intent> <intent> <action android:name="android.intent.action.VIEW" /> <data android:scheme="airwatch" /> </intent> </queries>
2. 跳转逻辑实现
直接调用React Native自带的Linking模块完成跳转,示例代码如下:
import { Linking, Alert } from 'react-native'; const jumpToHubAppDetail = async (hubAppId) => { const targetUrl = `workspaceone://apps/details?appid=${hubAppId}`; const compatibleUrl = `airwatch://apps/details?appid=${hubAppId}`; try { // 优先检测高版本协议是否可用 const canOpen = await Linking.canOpenURL(targetUrl); if (canOpen) { await Linking.openURL(targetUrl); return; } // 高版本不可用时尝试兼容协议 const canOpenCompatible = await Linking.canOpenURL(compatibleUrl); if (canOpenCompatible) { await Linking.openURL(compatibleUrl); return; } // 都不可用说明未安装Hub,可引导用户安装Hub Alert.alert('提示', '未检测到Intelligent Hub,请先安装Hub应用'); } catch (e) { console.error('跳转失败', e); } }
常见异常排查
- 跳转后进入Hub首页:优先校验传入的hubAppId是否正确,该ID可在Workspace ONE UEM控制台的对应应用详情页「部署设置」板块中获取,不要误填应用的包名或Bundle ID
- iOS端提示无法打开链接:确认Info.plist的LSApplicationQueriesSchemes配置已正确添加两个协议头,若使用Xcode14+版本打包,需确保配置没有被编译脚本覆盖
- 旧版本Hub跳转失败:可尝试调整参数,部分极旧版本Hub使用
applicationId作为参数名代替appid
内容的提问来源于stack exchange,提问作者AmitSingh
相关产品推荐
相关产品推荐

