I'm trying to open OpenStreetMap with OpenLayers on a wearable simulator using Tizen.
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>
Map is showing when testing the code in a normal web application, but when running with Tizen as a wearable map, it is not showing.
I get this error while debugging:
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
I think it's an issue in config.xml with access. I've tried lots of things, including adding these links to <access origin>
. Nothing works and I'm completely stuck.
Any help or tips would be greatly appreciated!
I figured it out, it seems that Tizen somehow blocks the normal OL CDN, use this
<script src="https://cdnjs.cloudflare.com/ajax/libs/ol3/4.1.1/ol.js"</script>
instead and it should be working fine!
Thanks all for the help.