访问诺基亚40系列中的谷歌地图API [英] Access google Maps API in nokia series 40
问题描述
我想在40系列手机中访问Google地图API。我尝试使用http连接,但地图静态显示。我想加载地图并移动地图中的位置,以便我必须动态地使用Google地图。
请给出一个想法来执行此操作。
Google Maps API 网站不包含JavaME(或Series 40)的特定SDK。可以使用静态Maps API,但只能用于静态图像(不支持动态平移或缩放)。
一个好的选择是使用诺基亚的 HERE地图。它的API旨在与JavaME协同工作,并提供Series 40设备的动态体验。 代码示例也可用,似乎是相当全面,包括平移,缩放和不同的地图类型。
PS:我不以任何方式隶属于诺基亚。我经常在我的诺基亚上使用这里的地图,我发现它是一个很好的地图解决方案。编辑:我得到了诺基亚HERE地图在Java SDK1.1模拟器上工作执行以下操作:
- 下载诺基亚Asha SDK 1.0。这(大)下载包含最新的库。
- 使用Java SDK 1.1创建一个新的JavaME项目。
- 登录到此处映射并创建应用程序标识和令牌。
-
在您的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){
//错误处理在这里。
}
public void onMapContentComplete(){
}
};
mapCanvas.getMapDisplay()。setState(
new MapDisplayState(new GeoCoordinate(52.51,13.4,0),10));
display.setCurrent(mapCanvas);
-
参考maps-core.jar在C:\Nokia\Devices\Nokia_Asha_SDK_1_0\plugins\maps api\lib中。
- 清理项目并运行。这应该显示一个基本的pannable和可缩放的地图。
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.
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.
这篇关于访问诺基亚40系列中的谷歌地图API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!