问题
I want to access the Google map API in series 40 mobiles. I tried with using http connection but the map displayed statically. I want to load the map and moving the location in the map so that I have to use the Google map dynamically.
Please give an idea to do this.
回答1:
The Google Maps API site does not contain a specific SDK for JavaME (or Series 40). The static Maps API can be used, but only for static images (no dynamic panning or zooming).
A good alternative is to use Nokia's HERE Maps. Its API is designed to work with JavaME and it offers a dynamic experience in Series 40 devices. Code Examples are also available and seem to be quite comprehensive, including panning, zoom and different map types.
PS: I'm not affiliated with Nokia in any way. I do use Here Maps on my Nokia quite frequently and I find it a good mapping solution.
EDIT: I got the Nokia HERE Maps working on a Java SDK1.1 emulator doing the following:
- Download the Nokia Asha SDK 1.0. This (HUGE) download contains the most up to date libraries.
- Create a new JavaME project using the Java SDK 1.1.
- Sign in to HERE Maps and create an App Id and Token.
Add the following code in your MIDlet.
public class MapMIDlet extends MIDlet { protected void startApp() throws MIDletStateChangeException { ApplicationContext.getInstance().setAppID("API IP"); ApplicationContext.getInstance().setToken("API TOKEN"); Display display = Display.getDisplay(this); MapCanvas mapCanvas = new MapCanvas(display){ public void onMapUpdateError(String description, Throwable detail, boolean critical) { // Error handling goes here. } public void onMapContentComplete() { } }; mapCanvas.getMapDisplay().setState( new MapDisplayState(new GeoCoordinate(52.51, 13.4, 0), 10)); display.setCurrent(mapCanvas); } }
Reference the maps-core.jar located in "C:\Nokia\Devices\Nokia_Asha_SDK_1_0\plugins\maps api\lib".
- Clean the project and run. This should display a basic pannable and zoomable map.
来源:https://stackoverflow.com/questions/17080047/access-google-maps-api-in-nokia-series-40