语言

Menu
Sites
Language
Using maps via javascript

Hello,  I am converting a bada project that has a Web UiControl with javascript.  The code worked in bada and the web browser but not for Tizen.  Tizen gets to the loadScript function but never calls initialize.  Are the google APIs not supported on tizen or am I missing something else?

Here is the relvant java script.

 

<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
  html { height: 100% }                                              
  body { height: 100%; margin: 0px; padding: 0px }
  #map_canvas { height: 100% }
</style>                                                        
<script type="text/javascript">
  var map;
  var myLatlng;               
  function initialize() {
  console.log("initialize");
    myLatlng = new google.maps.LatLng(35.363556, 138.730438);
    var myOptions = {
      zoom: 10,
 disableDefaultUI: true,
 disableDoubleClickZoom: true,
 draggable: false,
 keyboardShortcuts: false,
      center: myLatlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
  }
  
  function loadScript() {
  console.log("loadScript");
    var script = document.createElement("script");
    script.type = "text/javascript";
    script.src = "http://maps.googleapis.com/maps/api/js?sensor=true&callback=initialize";
    document.body.appendChild(script);
  }  
</script>
</head>
<body onload="loadScript()">
  <div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>
 
 
 

 

编辑者为: Brock Boland 17 3月, 2014 原因: Paragraph tags added automatically from tizen_format_fix module.

响应

13 回复
Ben Prendergast
Never mind, it looks like it is a device issue. Web calls through the application APIs work fine but the browser just doesn't work. Since this is a web control it apparently also doesn't work.
Addin Radies

This is Device Issues.

Damon McMahon

Web calls made through the application's APIs function correctly, but the browser is not functioning properly. Have you found a solution to this issue? 

More information https://developer.tizen.org/forums/native-application-development/ambilight-samsung-tv-tizen 
 

michealjasson

It seems that the issue you are facing is related to the Google Maps API not being supported on Tizen. The code you have provided relies on the Google Maps JavaScript API to display a map on a web page.

Tizen is an operating system based on Linux and is used primarily for mobile and wearable devices. It is possible that Tizen may not support certain features of the Google Maps API, or there may be compatibility issues between the two, view here..

One way to confirm this is to check the Tizen documentation and see if it supports the Google Maps API. If not, you may need to look for alternative solutions that are supported by Tizen.

Rachel Gomez

Map can be used when you want to perform an action on each element in a collection, and gather the results into a new array. In JavaScript, the "for loop" or "nesting" can complete the same task, but we can use map() to create more readable functions. Map can be created and initialized with the new Map() syntax.

Regards,

Rachel Gomez

Mary Solero

drywall installation

It is possible that the issue you are experiencing is due to the fact that Tizen does not support loading external scripts using HTTP. Instead, Tizen requires that all external resources are loaded using HTTPS. You may need to update your code to load the Google Maps API over HTTPS in order to get it to work on Tizen.

To load the Google Maps API over HTTPS, you can update the following line:


 
python
script.src = "http://maps.googleapis.com/maps/api/js?sensor=true&callback=initialize";

to:


 
python
script.src = "https://maps.googleapis.com/maps/api/js?sensor=true&callback=initialize";

This will ensure that the Google Maps API is loaded securely and should allow your code to work correctly on Tizen.

Additionally, you may want to ensure that the Tizen device you are testing on has internet connectivity and that there are no network-related issues preventing the Google Maps API from loading. You can use the Tizen Web Inspector to help diagnose any issues with your code or network connectivity.

Joana Davidson

it looks like it is a device issue. Web calls through the application APIs work fine but the browser just doesn't work.

 

Regards, 

 

Joana Davidson

<a href="https://www.google.com">Go to google</a>

Joana Davidson
Michele Sullivan

It appears to be an issue with the hardware. Using the application programming interfaces to make web calls is OK, however the browser itself is unusable.

Lee Williamson

Very nice, indeed.
Spinner Tools

Bonnie Chambers

Problem solved!

I solved problem!