第三方app跳转微信打开H5页面
https://material-shop-test-api.heaodaojia.com/mini/jdb/wx/authorization?mobile=13631629110&source=jdb&is_support_plan=0&js_type=3&path=%2F%23%2FsubPages%2Forder%2Fgenerate-order-online-material fun Context.openWechatBrowser(url: String?) {
try {
// 微信URL Scheme
val wechatUrl = "weixin://dl/business/webview?url=${Uri.encode(url)}"
// 创建Intent
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(wechatUrl))
// 检查是否有APP能处理这个Intent
if (intent.resolveActivity(this.packageManager) != null) {
// 启动Intent
this.startActivity(intent)
} else {
// 如果没有安装微信,可以提示用户或者采取其他操作
"请先安装微信".showToast(0)
}
} catch (e: Exception) {
e.printStackTrace()
"打开应用时发生错误".showToast(0)
// 处理异常情况
}
}