首页 > 解决方案 > 应该使用什么作为 url_launcher 中的 url 以使颤振应用程序在设备上打开内置摄像头?

问题描述

我了解到我们可以从 url_launcher 启动谷歌地图、电子邮件和Skype。在手机内置的相机应用程序中打开的 URL 应该是什么?

Android 和 iOS 都可以吗?

const url = 'https://www.google.com/maps/search/?api=1&query=52.32,4.917';
const url1 = 'cam:'; //what should be this url? 
if (await canLaunch(url1)) {
  await launch(url1);
} else {
  throw 'Could not launch $url';
}

标签: androidiosflutterdartcamera

解决方案


实际上,你不能从url_launcher打开相机,你需要一个名为image_picker的包,这样你就可以从内置的相机中获取图片或视频。


推荐阅读