简体   繁体   中英

how to open other install app in my flutter app?

i see this document => https://github.com/doxtitech/url_launcher_package_example/blob/master/lib/main.dart

but I don't want to open the 'mailto'.

If the app package name is 'kr.go.eduro.hcs', how can I open that app when I press the button?

My CODE:

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',
              ),
            ),
          ],
        ),
      ),
    );
  }
}

If you know application package name, you can do by using ' device_apps ' package.

// 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');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM