我最近将我的一个flutter应用程序的目标sdk升级到30。然后,拍照功能就无法正常工作了。出现了此链接中提到的错误:
PlatformException(no_available_camera, No cameras available for taking pictures., null)。
这与Android 11中的包可见性变更有关。现在,在第一个链接中有一个解决方案,通过在清单文件中添加以下行来查询设备上安装的所有软件包的权限。
PlatformException(no_available_camera, No cameras available for taking pictures., null)。
这与Android 11中的包可见性变更有关。现在,在第一个链接中有一个解决方案,通过在清单文件中添加以下行来查询设备上安装的所有软件包的权限。
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
对我而言,这是有效的。但query_all_packages文档说:
In the vast majority of cases, however, it's possible to fulfill your app's use cases by
interacting with the set of apps that are visible automatically and by declaring the other
apps that your app needs to access in your manifest file. To respect user privacy, your app
should request the smallest amount of package visibility necessary in order for your app to
work.
In an upcoming policy update, look for Google Play to provide guidelines for apps that need
the QUERY_ALL_PACKAGES permission.
这意味着,仅仅为了相机应用程序,我们不应该请求所有已安装程序的权限。现在我的问题是,应该在Android清单文件中添加什么以显示相机包?谢谢提前。