[英]how to open other install app in my flutter app?
我看到这个文件=> https://github.com/doxtitech/url_launcher_package_example/blob/master/lib/main.dart
但我不想打开'mailto'。
如果应用程序 package 名称是 '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',
),
),
],
),
),
);
}
}
如果您知道应用程序 package 名称,则可以使用“ 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');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.