【问题标题】:how to open other install app in my flutter app?如何在我的颤振应用中打开其他安装应用?
【发布时间】:2021-06-25 02:54:17
【问题描述】:

我看到了这个文件 => https://github.com/doxtitech/url_launcher_package_example/blob/master/lib/main.dart

但我不想打开“mailto”。

如果应用包名称是'kr.go.eduro.hcs',我如何在按下按钮时打开该应用?

我的代码:

class _CoronaSubScreenState extends State<CoronaSubScreen> {
  void customLaunch(command) async {
    if (await canLaunch(command)) {
      await launch(command);
    } else {
      print('$command is not load');
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            RaisedButton(
              onPressed: () {
                customLaunch('kr.go.eduro.hcs');
              },
              child: Text(
                'self',
              ),
            ),
          ],
        ),
      ),
    );
  }
}

【问题讨论】:

    标签: flutter dart


    【解决方案1】:

    如果您知道应用程序包名称,则可以使用“device_apps”包。

    // Check whether app is installed
    bool isInstalled = await DeviceApps.isAppInstalled('com.frandroid.app');
    
    // Call open the application what you want
    DeviceApps.openApp('com.frandroid.app');
    

    【讨论】:

      猜你喜欢
      • 2019-05-26
      • 2022-01-03
      • 1970-01-01
      • 2019-05-15
      • 1970-01-01
      • 1970-01-01
      • 2020-09-03
      • 1970-01-01
      • 2021-07-02
      相关资源
      最近更新 更多