简体   繁体   English

未经系统许可如何在android 7.0的NDK中打开相机

[英]How to open camera in NDK of android 7.0 without system permission

As we know, Google set more permission in Android 7.0. 众所周知,Google在Android 7.0中设置了更多权限。 We can't user camera API directly in Android 7.0. 我们无法直接在Android 7.0中使用相机API。 Google has provided a library to developer named libcamera2ndk.so. Google为开发人员提供了一个名为libcamera2ndk.so的库。 But I'm confused that this library should take android system permission or needs system certificated signature for APK. 但是我很困惑,这个库应该获得android系统许可或需要APK的系统认证签名。
ACameraManage_getCameraIdList() shows numCameras is 0 when I run APK without any system permission. 当我在没有任何系统许可的情况下运行APK时, ACameraManage_getCameraIdList()显示numCameras为0。

Could you tell me some method about how to call libcamera2ndk.so without and system permission. 您能否告诉我一些未经系统许可而如何调用libcamera2ndk.so的方法。 I can't find any useful information in Google. 我在Google中找不到任何有用的信息。 Please help me. 请帮我。

If I'm not wrong, there is no way to do it, because if you could do this you could make pictures without the user know about it and that is a potentional security problem too. 如果我没记错的话,那是没有办法的,因为如果这样做,您可能会在用户不知道的情况下制作照片,这也是潜在的安全问题。

As you can read the comments adding android.permission.CAMERA to your AndroidManifest.xml file should do it. 如您android.permission.CAMERA ,将android.permission.CAMERA添加到您的AndroidManifest.xml文件中应该可以做到。

The other way is you request for permission in run time. 另一种方法是在运行时请求许可。 There is the Google's documentation for it: https://developer.android.com/training/permissions/requesting.html 有适用于Google的文档: https : //developer.android.com/training/permissions/requesting.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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