Google地图与黑莓整合
问题描述:
我想将Google地图整合到我的黑莓原生应用程序中。我的要求是:Google地图与黑莓整合
- 搜索最近的位置
- 针,小弹出窗口将显示在地图上
- 攻上任何引脚的位置在那里用户可以查看详细 描述
- 工具显示地址的提示应该是交互式的。
与附加图像相似的东西。引导我与样品来实现它。
答
您可以使用GMLocation位置例如
GMLocation location = new GMLocation(51.507778, -0.128056, "London");
invokeGMaps(location);
invokeGMaps方法
public void invokeGMaps(GMLocation l) {
int mh = CodeModuleManager.getModuleHandle("GoogleMaps");
if (mh == 0) {
try {
throw new ApplicationManagerException("GoogleMaps isn't installed");
} catch (ApplicationManagerException e) {
System.out.println(e.getMessage());
}
}
RichTextField rich = new RichTextField("fhfdjdytdytd"+ mh);
add(rich);
URLEncodedPostData uepd = new URLEncodedPostData(null, false);
uepd.append("action", "LOCN");
uepd.append("a", "@latlon:" + l.getLatitude() + "," + l.getLongitude());
uepd.append("title", l.getName());
uepd.append("description", l.getDescription());
String[] args = { "http://gmm/x?" + uepd.toString() };
RichTextField rich1 = new RichTextField("l.getName()"+ l.getName());
add(rich1);
ApplicationDescriptor ad = CodeModuleManager.getApplicationDescriptors(mh)[0];
ApplicationDescriptor ad2 = new ApplicationDescriptor(ad, args);
try {
ApplicationManager.getApplicationManager().runApplication(ad2, true);
} catch (ApplicationManagerException e) {
System.out.println(e.getMessage());
}
}
GMLocation类
public class GMLocation {
String mName;
String mDescription;
double mLatitude;
double mLongitude;
public GMLocation(double lat, double lon) {
mLatitude = lat;
mLongitude = lon;
}
public GMLocation(double d, double e, String name) {
this(d, e);
mName = name;
}
public GMLocation(double lat, double lon, String name, String descr) {
this(lat, lon, name);
mDescription = descr;
}
public String getName() {
return mName;
}
public String getDescription() {
return mDescription;
}
public String getLongitude() {
return String.valueOf(mLongitude);
}
public String getLatitude() {
return String.valueOf(mLatitude);
}
}
感谢您的快速回复。使用这种方法,这会调用Google地图应用程序。任何其他方式来集成我的应用程序内相同取决于其他应用程序? –
但我想你可以在brouserfield中使用谷歌地图网址。 https://developers.google.com/maps/documentation/staticmaps/#URL_Parameters此链接用于此 – Rajkiran