You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter Web唤起移动端已安装App失败问题求助

Flutter Web唤起移动端已安装App失败问题求助

我现在碰到一个棘手的问题,想在Flutter Web应用里实现这样的逻辑:如果用户手机上已经安装了我的App,就直接唤起它;要是没装的话,就跳转到应用商店引导安装。

目前的情况是,当我在Android本地环境运行代码时,唤起App的功能是正常的,但把代码放到Chrome浏览器里运行时,完全无法唤起已经安装好的App。

下面是我写的实现代码:

void openMyApp() async {
  final myAppUrl = "myapp://open"; // 自定义的App URL Scheme
  final playStoreUrl = "应用商店对应App的下载链接"; 
      
  // 尝试唤起App
  if (await canLaunchUrl(Uri.parse(myAppUrl))) {
    print("launch app");
    await launchUrl(Uri.parse(myAppUrl));
  } else {
    // 如果App未安装,延迟后打开应用商店链接
    await Future.delayed(const Duration(milliseconds: 1500), () async {
      if (await canLaunch(playStoreUrl)) {
        await launch(playStoreUrl);
      }
    });
  }
}

有没有大佬能帮我看看,为什么在Chrome里就没法唤起已安装的App呀?麻烦给点解决思路或者修改建议,谢谢啦!

备注:内容来源于stack exchange,提问作者Elabd Flutter

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.15 15:34:33