我需要在正在開發針對黑莓OS 6.0的應用程序中使用Bing地圖。但找不到任何本地可用的框架或SDK。請幫助我在BlackBerry上使用Bing或Google Maps SDK。請提供我可以從哪裏獲得SDK的參考資料。謝謝。Bing Maps SDK For Blackberry 6.0
3
A
回答
3
這是一個使用Google地圖的例子,不知道如何使用Bing地圖。
首先,通過在設備/模擬器的瀏覽器上點擊此鏈接,將谷歌地圖安裝到您的設備/模擬器上,出現http://m.google.com/maps/。
然後,您可以從您的應用程序調用Google Maps應用程序。下面是一個代碼示例:
package mypackage;
import net.rim.blackberry.api.browser.URLEncodedPostData;
import net.rim.device.api.system.ApplicationDescriptor;
import net.rim.device.api.system.ApplicationManager;
import net.rim.device.api.system.ApplicationManagerException;
import net.rim.device.api.system.CodeModuleManager;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.FieldChangeListener;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.BasicEditField;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.container.VerticalFieldManager;
/**
* A class extending the MainScreen class, which provides default standard
* behavior for BlackBerry GUI applications.
*/
public final class MyScreen extends MainScreen
{
/**
* Creates a new MyScreen object
*/
public MyScreen()
{
// Set the displayed title of the screen
setTitle("Google Maps");
VerticalFieldManager mainManager = new VerticalFieldManager(USE_ALL_HEIGHT | USE_ALL_WIDTH);
final BasicEditField latitudeInputField = new BasicEditField("Latitude:" , "23.717782");
final BasicEditField longitudeInputField = new BasicEditField("Longitude:" , "90.407124");
final BasicEditField titleInputField = new BasicEditField("Title:" , "Dhaka, Bangladesh");
final BasicEditField descriptionInputField = new BasicEditField("Description:" , "Capital City of Bangladesh");
ButtonField btn_ShowMap = new ButtonField("Show On Map");
btn_ShowMap.setChangeListener(new FieldChangeListener() {
public void fieldChanged(Field field, int context) {
double lat = Double.parseDouble(latitudeInputField.getText());
double lon = Double.parseDouble(longitudeInputField.getText());
String title = titleInputField.getText();
String description = descriptionInputField.getText();
showGoogleMap(lat, lon, title, description);
}
});
mainManager.add(latitudeInputField);
mainManager.add(longitudeInputField);
mainManager.add(titleInputField);
mainManager.add(descriptionInputField);
mainManager.add(btn_ShowMap);
add(mainManager);
}
/**
* Starts the Google Maps application and the specified locatin is shown on map
* @param latitude the latitude of the location to show
* @param longitude the longitude of the location to show
* @param title the title of the location to show
* @param description the description of the location to show
*/
public void showGoogleMap(double latitude, double longitude, String title, String description) {
try {
int mh = CodeModuleManager.getModuleHandle("GoogleMaps");
if (mh == 0) {
throw new ApplicationManagerException("GoogleMaps isn't installed");
}
URLEncodedPostData uepd = new URLEncodedPostData(null, false);
uepd.append("action","LOCN");
uepd.append("a", "@latlon:"+latitude+","+longitude);
uepd.append("title", title);
uepd.append("description", description);
String[] args = { "http://gmm/x?"+uepd.toString() };
ApplicationDescriptor ad = CodeModuleManager.getApplicationDescriptors(mh)[0];
ApplicationDescriptor ad2 = new ApplicationDescriptor(ad, args);
ApplicationManager.getApplicationManager().runApplication(ad2, true);
} catch(final Exception excp) {
Dialog.alert("Sorry, can't start Google Map: " + excp.getMessage());
}
}
}
這是應該的樣子:
我只在模擬器9800(OS 6)
3
檢查Nutiteq RIM BlackBerry Mapping SDK。
您可以從Bing Maps,Yahoo!獲取地圖內容。地圖,OpenStreetMap等等。通過Nutiteq BlackBerry mapping SDK tutorial開始編碼。
相關問題
- 1. Bing Maps SDK - Silverlight
- 2. 安裝BlackBerry 6.0的SDK 6.0
- 3. 谷歌地圖Api vs Bing Maps for C#
- 4. 使用Bing Maps Android SDK作爲庫
- 5. Bing Maps for WPF,MapInfo/Pushpins的ZIndex?
- 6. Google Maps SDK for IOS Directions
- 7. Bing Maps API - setBounds
- 8. Silverlight Bing Maps - Pushpin
- 9. Bing Maps和MVVM
- 10. bing maps RouteResponse.Results.RoutePath.Points = null?
- 11. User-Agent和Blackberry 6.0?
- 12. Bing Maps - Javascript vs Silverlight
- 13. Bing Maps API v7限制
- 14. Bing Maps v8 JS API
- 15. Bing Maps私人TileSource
- 16. MS MapCruncher - Silverlight Bing Maps
- 17. Windows Phone 7 - Bing Maps
- 18. Facebook Connect for BlackBerry
- 19. Http Post with Blackberry 6.0問題
- 20. Bing地圖不是在BlackBerry
- 21. 可以設計Google Maps SDK for iOS嗎?
- 22. paypal api for blackberry
- 23. WebWorks for Blackberry開發
- 24. 需要更多模擬器的BlackBerry SDK 6.0
- 25. Bing Maps上下文菜單
- 26. LocationProvider在BlackBerry 6.0中超時?
- 27. Jailcoder SDK 6.0
- 28. Bing for Sharepoint?
- 29. 如何刷新Bing Maps AJAX?
- 30. Bing Maps交易跟蹤
@HeartBeat ..我不認爲使用這是一個很好的選擇,因爲這調用了另一個應用程序和依賴。如果地圖被刪除,那麼你的應用程序將無法工作。 - – 2012-04-20 06:31:29