Google Tango API之User Permission

2017-01-05  本文已影响33人  60916fc63567

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通过使用来自设备的相机的视觉提示工作。我们希望用户了解相机正在使用的时间和原因,因此在使用区域学习或显示相机预览之前,您必须询问用户权限。

Users may control access to Tango features for each application. This can happen when Tango requests it, or if the user grants permission at request time, they can also revoke permission later using the permission manager under Settings > Device > Project Tango > Permissions. For more information, see Managing Permissions.

用户可以控制每个应用程序对Tango功能的访问。这可能发生在Tango请求时,或者如果用户在请求时授予权限,他们也可以稍后使用设置>设备>Project Tango>权限下的权限管理器撤销权限。有关详细信息,请参阅管理权限。

Requesting permission


Applications using Tango need permission from the user to use area learning, depth perception or the camera previews.Requesting permission for area learning varies by language. Here are the API-specific instructions:

C

Java

Unity

Applications that intend to use depth perception or show the camera preview must request the Android Camera permission in their manifest to get access to the camera feed through the Tango API.

We recommend that an application does not request a permission until it is necessary. The user should see an immediate effect of the permissions they grant. It is usually not recommended to have the application request permissions at startup; this will slow down initialization and burden the user with permission prompts for features they may never use.

要使用深度感知或显示相机预览的应用程序必须在清单中请求Android相机权限,才能通过Tango API访问相机Feed。

我们建议应用程序在需要之前不会请求权限。用户应该看到他们授予的权限的即时效果。通常不推荐在启动时具有应用程序请求权限;这将减慢初始化,并为用户提供他们可能从不使用的功能的权限提示。

Handling permission denial


The TangoErrorType has several enumerated values to let you know if an API call failed due to not having proper user permissions:

TANGO_NO_ADF_PERMISSION

TANGO_NO_IMPORT_EXPORT_PERMISSION

TANGO_NO_CAMERA_PERMISSION

If the user denies a permission request, or revokes permission for Area Learning, the TangoService will return the appropriate error type when an application tries to use that feature.

If your application requires but didn’t request the camera permission in AndroidManifest.xml, the system will return the TANGO_NO_CAMERA_PERMISSION error type.

You can handle these permission denial situations in several ways. One way is to simply have the application inform the user that it cannot run without the requested permission, and fail gracefully. Another possibility is to implement a fallback method. For example, you could use motion tracking alone if the user did not grant area learning permissions.

TangoErrorType有几个枚举值,让您知道一个API调用是否失败,由于没有适当的用户权限:

TANGO_NO_ADF_PERMISSION

TANGO_NO_IMPORT_EXPORT_PERMISSION

TANGO_NO_CAMERA_PERMISSION

如果用户拒绝了权限请求,或者撤消了区域学习的权限,当应用程序尝试使用该功能时,TangoService将返回相应的错误类型。

如果应用程序需要但未在AndroidManifest.xml中请求相机权限,系统将返回TANGO_NO_CAMERA_PERMISSION错误类型。

您可以通过几种方式处理这些权限拒绝的情况。一种方法是简单地让应用程序通知用户它不能在没有请求的权限的情况下运行,并且正常失败。另一种可能性是实现回退方法。例如,如果用户未授予区域学习权限,则可以单独使用运动跟踪。

上一篇下一篇

猜你喜欢

热点阅读