【问题标题】:Tizen wearable web application not asking for (GPS) permissionsTizen 可穿戴 Web 应用程序不要求 (GPS) 权限
【发布时间】:2017-05-24 15:07:06
【问题描述】:

我正在尝试从三星 Gear S3 读取我的 GPS 数据,当我在 Tizen 工作室中模拟它时,我的项目工作正常。当我在实时 Gear S3 上运行该项目时,它没有获得任何 GPS 数据。

我在模拟应用程序时收到此弹出窗口,但我没有在齿轮上弹出询问我任何权限的弹出窗口,所以我认为这与问题有关。

我做过的事情:

  • Gear 的 GPS 仅在 GPS 上启用。
  • 每次尝试都重建、清理、重新启动所有内容、卸载应用程序。
  • 项目有三星证书
  • 为 config.xml 添加了一系列功能和权限(参见下面的代码)

代码

config.xml 如上所述,包括一堆可能不必要的功能和权限。

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns:tizen="http://tizen.org/ns/widgets" xmlns="http://www.w3.org/ns/widgets" id="http://yourdomain/OSMLEAF" version="1.0.0" viewmodes="maximized">
    <access origin="*" subdomains="true"></access>
    <tizen:application id="5lI7dRUWxx.OSMLEAF" package="5lI7dRUWxx" required_version="2.3.1"/>
    <content src="index.html"/>
    <feature name="http://tizen.org/feature/screen.size.all"/>
    <feature name="http://tizen.org/feature/location.gps"/>
    <feature name="http://tizen.org/feature/location.gps.satellite"/>
    <feature name="http://tizen.org/feature/location"/>
    <feature name="http://tizen.org/feature/location.geofence"/>
    <feature name="http://tizen.org/feature/location.batch"/>
    <icon src="icon.png"/>
    <name>OSMLEAF</name>
    <tizen:privilege name="http://tizen.org/privilege/notification"/>
    <tizen:privilege name="http://tizen.org/privilege/setting"/>
    <tizen:privilege name="http://tizen.org/privilege/system"/>
    <tizen:privilege name="http://tizen.org/privilege/package.info"/>
    <tizen:privilege name="http://tizen.org/privilege/location"/>
    <tizen:privilege name="http://tizen.org/privilege/internet"/>
    <tizen:privilege name="http://tizen.org/privilege/application.launch"/>
    <tizen:privilege name="http://tizen.org/privilege/filesystem.read"/>
    <tizen:privilege name="http://tizen.org/privilege/filesystem.write"/>
    <tizen:privilege name="http://tizen.org/privilege/download"/>
    <tizen:profile name="wearable"/>
    <tizen:setting background-support="enable" encryption="disable" hwkey-event="enable"/>
</widget>

编辑:我正在尝试处理坐标的 javascript:

    var options = {enableHighAccuracy: true,timeout: 0};
    function successCallback(position)
    {
        console.log("succes");

        currentGpsPosLat = position.coords.latitude;
        currentGpsPosLong = position.coords.longitude;
        marker.setLatLng([currentGpsPosLat,currentGpsPosLong]);
        console.log("going to"+ currentGpsPosLong + " -- " +currentGpsPosLat);

    }


    var marker = L.marker([0.0, 0.0],{icon:carIcon}).addTo(map);


    function errorCallback(error)
    {
        console.log("error");
        console.log(error);
    }

    navigator.geolocation.watchPosition(successCallback, errorCallback, options);

    window.setInterval(function(){

        marker.setLatLng([currentGpsPosLat,currentGpsPosLong]);
        map.flyTo([currentGpsPosLat,currentGpsPosLong], 17);
        }, 10000);

在互联网上找不到有关此问题的任何信息,因此非常感谢任何帮助我指出正确方向的帮助!

【问题讨论】:

  • 你想做什么?给出一些示例代码
  • 嗨,Iqbal,我已经从我正在尝试做的事情中添加了 javascript。我正在尝试创建一个图标并不断将图标移动到 GPS 位置。如果您需要更多信息,请告诉我,感谢您与我一起思考!
  • 它是 Tizen API 吗?我认为这是第三方 api。这不是 Tizen 的一部分,可能是 var marker = L.marker([0.0, 0.0],{icon:carIcon}).addTo(map);

标签: javascript config tizen tizen-wearable-sdk tizen-web-app


【解决方案1】:

Gear S3 不是随 Tizen 2.3.2 一起发布的吗?这很小,但您可能希望将所需的最低版本从 2.3.1 设置为 2.3.2。

您可能希望从三星商店安装一款免费的基于 GPS 的实用程序,以确保您能够在测试环境中获得定位。在室内和室外的某些位置,良好的 GPS 定位将具有挑战性。值得将其排除为可能的问题来源。

我刚刚回去查看了一个 GPS 应用程序,该应用程序用于验证一些信息。我正在使用带蜂窝网络的 Gear S2,在最后一次固件更新后,它的行为与 Gear S3 相同,但减去了 MST。

您提到没有收到位置权限提示。手表不提示位置权限。位置信息的声明在清单中是必需的(如果它不存在,那么您将不会获得 GPS 信息),并在应用商店中显示为所需的权限。一旦用户安装它,它就可以工作了。请注意,功能声明不会在您的应用程序中产生任何功能差异。这些声明用于网络商店列表。

在您分享的代码片段中,我无法判断 currentGpsPosLat/currentGpsPosLong 是否在超时功能的范围内,但您不需要该功能,因为您将在从那里获取信息时设置位置全球定位系统。

在您的成功回调中,调用marker.setLatLng之前调用console.log。如果 setLatLng 出现任何问题,该函数将安静地终止,您将无法知道该函数是否被调用。如果您颠倒顺序,那么您将能够查看该函数是否被调用但在完成之前失败。

我的应用程序只需要几个权限。

<tizen:privilege name="http://tizen.org/privilege/location"/>
<tizen:privilege name="http://tizen.org/privilege/application.launch"/>

【讨论】:

    猜你喜欢
    • 2017-01-03
    • 1970-01-01
    • 2019-12-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多