Archived:Optimize HERE Map Type Selector for Asha 305, Asha 306 and Asha 311
Article Metadata
Article
This article uses a deprecated version of the Nokia Maps API for JavaScript to display a Map on a Java ME device. The Nokia Maps API for JavaScript is not considered to be an appropriate API to use in the Java ME environment, as a large JavaScript library would need to be regularly downloaded onto a memory constricted device, and un-cached Map tiles would need to be regularly requested which would result in a large amount of data traffic.
Nokia offers two alternative APIs which are more suitable for Java ME development
- For a simple static map using the RESTful Maps API within a web widget is considered to be a reasonable lightweight solution.
- For dynamic mapping use cases, the Nokia Maps API for Java ME is a Native API which would be preferred more complex development.
- Static mapping services do not cache or tile the images when requested, therefore each request involves a round trip to the server. If the map on a mobile application needs to be refreshed at any time, using a caching library will result in a reduction in network traffic after around three maps have been displayed. An explanation of this can be found here
Asha 305, Asha 306, Asha 311 are Series 40 devices with new full touch UI which will provide a better user experience for map operation. And developers may not construct ScaleBar and ZoomBar for user. But these devices only support HTML 4.0, Developers can only use Nokia Map API for Web to display map in Browser or Widget.
This is a simple Nokia map example with TypeSelector.
<html>
<head>
<script type="text/javascript" charset=UTF-8"
src="http://api.maps.nokia.com/2.0.0/jsl.js?"></script>
<style type="text/css">
html {
overflow:hidden;
}
body {
margin: 0;
padding: 0;
overflow: hidden;
}
#mapContainer {
width: 100%;
height: 100%;
left: 0;
top: 0;
position: absolute;
}
</style>
</head>
<body >
<div id="mapContainer"></div>
<script type="text/javascript">
var mapContainer = document.getElementById("mapContainer");
var map = new nokia.maps.map.Display(mapContainer, {
components: [
new nokia.maps.map.component.Behavior(),
new nokia.maps.map.component.TypeSelector()
]
});
</script>
</body>
</html>
After run,the TypeSelector may extend un-completely.
Because these 3 Asha devices's portrait screen width is less than width of horizontal extending TypeSelector. Maybe many developers don't think it's a question because user can rotate to landscape screen which has full width and is fit for 2 hands hold. But I think developers had better provide users another convenience way which let them operate map when only can use single hand.
So the newer version of Nokia Map API for Web is introduced to settle this question, only alter another Javascript file.
...
<script type="text/javascript" charset=UTF-8"
src="http://api.maps.nokia.com/2.1.0/jsl.js?"></script>
...
And the TypeSecector will extend vertical,
which is not only fit for 3 Nokia Asha devices but also for many other limited screen devices.
Way above is good but I prefer next which via increasing the width of the map container.
...
<script type="text/javascript" charset=UTF-8"
src="http://api.maps.nokia.com/2.0.0/jsl.js?"></script>
...
#mapContainer {
width: 150%;
...
The TypeSelector doesn't appear first
before user drag mapcontainer from right to left.
The TypeSelector can extend horizontal completely,
and be dragged,selected or closed.
Please read Archived:Update Nokia Online Maps Style for Asha Full Touch for better map services on Asha full touch.



Hamishwillee - This is not the recommended implementation
Hi r60600
As I understand it the problem faced is that "The Type selector control from the Nokia Map API for Web is designed for a wider screen than a typical web widget". The problem version of the API you're talking about is an old version, and your solution is to replace it with another out-of-date old version of the api which appears a bit better.
That doesn't make sense to me. In general we'd recommend that anyone who wants to use maps on a Java ME device use the "Maps API for Java", rather than trying to get the web API work through the browser - for a start, as far as I know you'd get offline maps, and a framework designed to work on the device.
Please look closely at the English - I don't understand the first sentences.
Regards
Hamishhamishwillee 07:47, 30 July 2012 (EEST)
Hamishwillee - Suggestions for improvement
Suggestion from our technical expert is that the following applies to an implmentation that is "optimised for touch":
Suggestion is that you use icons instead like the Java Me IconCommandBar - so you could rewrite this example:
- Write a custom MapCompoment extending the TypeSelector component. (This has been done with the Tabbed InfoBubble)
- When the MapComponent is attached to map, do some JavaScript magic to retrieve the DOM element holding the texts “Street Map”, “Satellite” etc.
- Replace these texts with pictures which are touchable icons.
There is then no need resize the screen, and the Web App is properly touchable.hamishwillee 06:39, 2 August 2012 (EEST)