Skip to content
Advertisement

Here SDK – Change map location

This is the sample code from Here API. But the problem I have is that the initial location where the map is loaded is wrong. What I need is for the map to be displayed where you are.

What is the method that modifies the position of the map?

JavaScript

Advertisement

Answer

This is the piece of code that hard codes the position:

JavaScript

Instead, set the coordinates to be the user’s click. In order to do so, you will need to surround that piece of code with an onTouch() listener and check the action of the user. I’ll use an ImageView as an example. So something like this:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement