gpt4 book ai didi

javascript - 无法在 Tizen 可穿戴 Web 应用程序中显示 OpenStreepMap

转载 作者:行者123 更新时间:2023-12-03 04:17:12 26 4
gpt4 key购买 nike

我正在尝试使用 Tizen 在可穿戴模拟器上使用 OpenLayers 打开 OpenStreetMap

HTML

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width,user-scalable=no">
<title>Circular UI</title>
<link rel="stylesheet" href="lib/tau/wearable/theme/default/tau.min.css">
<link rel="stylesheet" media="all and (-tizen-geometric-shape: circle)"
href="lib/tau/wearable/theme/default/tau.circle.min.css">
<!-- load theme file for your application -->
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="ui-page ui-page-active" id="main">
<header class="ui-header">
<h2 class="ui-title">TAU Basic</h2>
</header>
<div class="ui-content content-padding">
<p>test </p>
<div id="map"></div>
</div>
</div>
<script src="ol.js"></script>
<script type="text/javascript" src="lib/tau/wearable/js/tau.min.js"></script>
<script src="jquery-3.2.1.min.js"></script>
<script src="app.js"></script>
<script src="lowBatteryCheck.js"></script>
</body>
</html>

app.js

$(function(){
new ol.Map({
layers: [
new ol.layer.Tile({source: new ol.source.OSM()})
],
view: new ol.View({
center: [0, 0],
zoom: 2
}),
target: 'map'
});

config.xml

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets"
xmlns:tizen="http://tizen.org/ns/widgets" id="http://yourdomain/OSMOL"
version="1.0.0" viewmodes="maximized">
<access origin="*" subdomains="true"/>
<access origin="http://openlayers.org/" subdomains="true"/>
<access origin="https://openstreetmap.org/" subdomains="true"/>
<content src="index.html"/>
<feature name="http://tizen.org/feature/screen.size.normal"/>
<icon src="icon.png"/>
<name>OSMOL</name>
<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"/>
<feature name="http://tizen.org/feature/location.gps"/>
<tizen:privilege name="http://tizen.org/privilege/location"/>
<tizen:profile name="wearable"/>
<tizen:setting hwkey-event="enable"/>
</widget>

在普通 Web 应用程序中测试代码时, map 会显示,但是当使用 Tizen 作为可穿戴 map 运行时,它不会显示。

我在调试时遇到此错误:

GET https://c.tile.openstreetmap.org/2/1/1.png net::ERR_NAME_RESOLUTION_FAILED c.tile.openstreetmap.org/2/2/2.png:1 GET https://c.tile.openstreetmap.org/2/2/2.png net::ERR_NAME_RESOLUTION_FAILED b.tile.openstreetmap.org/2/1/2.png:1 GET 2 more of the same, cant post due reputation

我认为这是 config.xml 中的访问问题。我尝试了很多方法,包括将这些链接添加到 <access origin> 。什么都不起作用,我完全陷入困境。

任何帮助或提示将不胜感激!

最佳答案

在模拟器上运行怎么样?我怀疑连接问题

当我开始将移动应用程序移植到可穿戴设备时,我认为它不需要黑魔法就可以工作:

https://github.com/tizenteam/mapo/tree/tizen-2.3-wearable

关于javascript - 无法在 Tizen 可穿戴 Web 应用程序中显示 OpenStreepMap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44097480/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com