2016-08-01 28 views
1

即時通訊試圖在android上製作一個應用程序,只是一個使用智能手機GPS的典型地圖,我正在計劃使用Dijkstra的最短路徑算法。在Android上製作一個地圖

我打算做的是製作一個島嶼的頂視圖地圖,並從我的gps收集島嶼公路上每個路口的緯度和經度數據,將圖像(我製作的島嶼地圖)與緯度然後經度數據實現Dijkstra的最短路徑算法。

有什麼建議嗎?

我該怎麼辦呢?

回答

0

第一 活動文件

GoogleMap的GoogleMap的; googleMap =((MapFragment)getFragmentManager()。findFragmentById(R.id.map))。getMap();

0

按照Getting Started

本指南是一個快速的開始添加地圖到Android應用程序。 Android Studio是使用Google Maps Android API構建應用的推薦開發環境。

步驟1.下載Android工作室

第2步:安裝谷歌Play服務SDK

步驟3.創建一個谷歌地圖項目

第4步:獲取谷歌地圖API密鑰

第5步。你好地圖!看看代碼

第6步:連接Android設備

第7步:生成並運行你的應用程序


啓用GPS:

@Override 
protected void onStart() { 
super.onStart(); // Always call the superclass method first 

// The activity is either being restarted or started for the first time 
// so this is where we should make sure that GPS is enabled 
LocationManager locationManager = 
(LocationManager) getSystemService(Context.LOCATION_SERVICE); 
boolean gpsEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); 

if (!gpsEnabled) { 
// Create a dialog here that requests the user to enable GPS, and use an intent 
// with the android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS action 
// to take the user to the Settings screen to enable GPS when they click "OK" 
} 
} 

希望這幫助!

相關問題