Permission Dialogs for Users in Java在Java中用户使用的权限对话框
Tango works by using visual cues from the device's cameras. We want users to understand when and why the cameras are being used, so you must ask users for permission prior to using area learning or displaying the camera preview.
Tango通过使用设备的摄像头中的视觉信号来工作。我们希望用户能理解摄像头什么时候和为什么被使用,因此在使用区域学习或者展示摄像头预览之前你必须请求用户权限许可。
TangoService will not work without the user's permission in these cases.
TangoService在这些例子中如果没有用户的许可将无法工作。
How to request user permission如何请求用户许可
Android Camera permission安卓摄像头许可
Applications that intend to use depth perception or show the camera preview must request the Android Camerapermission in their manifest to get access to the camera feed through the Tango API.要使用深度感知或者显示摄像头预览的应用必须在manifest中请求Android Camera许可来通过Tango API获得摄像头反馈。
ADF permissionsADF文件许可
ADF Load/Save intent ADF加载/保存意图
To request load/save permission, call the following Android permission intent. If the user hasn't given permission, this intent will show a popup asking for the permission. If you call this intend and the user already gave permission, no popup will be shown.
要请求加载/保存许可,必须调用下面的Android的许可意图。如果用户没有给出许可,该意图将显示一个弹出框请求该许可。如果你调用该意图并且用户已经给出许可,那么将不会显示弹出框。
startActivityForResult(
Tango.getRequestPermissionIntent(Tango.PERMISSIONTYPE_ADF_LOAD_SAVE),
Tango.TANGO_INTENT_ACTIVITYCODE);
ADF Import intent ADF导入意图
Use Tango.importAreaDescriptionFile()
to import an ADF from the filesystem. A permission screen will appear each time you call the method.
使用Tango.importAreaDescriptionFile()从文件系统中导入ADF文件。每当你调用该方法时将会出现一个许可屏幕。
You can also create the intent yourself:
你还可以创自己建意图。
private static final String INTENT_CLASSPACKAGE = "com.projecttango.tango";
private static final String INTENT_IMPORTEXPORT_CLASSNAME = "com.google.atap.tango.RequestImportExportActivity";
// startActivityForResult requires a code number.
private static final String EXTRA_KEY_SOURCEFILE = "SOURCE_FILE";
Intent importIntent = new Intent();
importIntent.setClassName(INTENT_CLASSPACKAGE, INTENT_IMPORTEXPORT_CLASSNAME);
importIntent.putExtra(EXTRA_KEY_SOURCEFILE, filepath);
thisActivity.startActivityForResult(importIntent, Tango.TANGO_INTENT_ACTIVITYCODE);
ADF Export intent ADF导出意图
Use Tango.exportAreaDescriptionFile()
to export an ADF to the filesystem. A permission screen will appear for each intent you send.
使用Tango.exportAreaDescriptionFile()导出ADF到文件系统。一个许可屏幕将在每次你发送的意图时出现。
You can also create the intent yourself:
你也可以创建你自己的意图:
private static final String INTENT_CLASSPACKAGE = "com.projecttango.tango";
private static final String INTENT_IMPORTEXPORT_CLASSNAME = "com.google.atap.tango.RequestImportExportActivity";
// startActivityForResult requires a code number.
private static final String EXTRA_KEY_SOURCEUUID = "SOURCE_UUID";
private static final String EXTRA_KEY_DESTINATIONFILE = "DESTINATION_FILE";
Intent exportIntent = new Intent();
exportIntent.setClassName(INTENT_CLASSPACKAGE, INTENT_IMPORTEXPORT_CLASSNAME);
exportIntent.putExtra(EXTRA_KEY_SOURCEUUID, mUUIDList[info.position]);
exportIntent.putExtra(EXTRA_KEY_DESTINATIONFILE, mAppSpaceADFFolder);
thisActivity.startActivityForResult(exportIntent, Tango.TANGO_INTENT_ACTIVITYCODE);
API exceptions API例外
If you try to call a method that requires a permission that has not been granted, the Java API throws aSecurityException with a detailed message corresponding to the permission that failed.
如果你试着调用一个方法,它需要一个许可但是却并没有被授予,那么Java API将会抛出一个安全例外带有跟许可失败相关的详细信息。
API calls that require permission需要许可的API调用
The following calls in the Java API require the user's permission.
下面的调用都需要用户许可。
API calls that require Tango.PERMISSIONTYPE_ADF_LOAD_SAVE需要Tango.PERMISSIONTYPE_ADF_LOAD_SAVE的API调用
Tango.saveAreaDescription
Tango.deleteAreaDescription
Tango.listAreaDescriptions
Tango.loadAreaDescriptionMetaData
Tango.saveAreaDescriptionMetadata
API calls that require Android Camera permissions需要Android Camera许可的API调用
Tango.getCameraIntrinsics
onXYZijAvailable
callback ofTango.OnTangoUpdateListener
onFrameAvailable
callback ofTango.OnTangoUpdateListener
Tango.connectTextureId
Tango.disconnectCamera
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)