1 / 20

GPS 軌跡紀錄

GPS 軌跡紀錄. 指導 教授:李志清 學生姓名:陳振堃 MA130226. GPS 軌跡紀錄. 利用覆寫 LocationListener 的 onLocationChanged (); 來追蹤目前的座標位置。 在偵測 到 Location 座標變更時,利用 GP1,GP2 座標的不同,在 MapView 上畫線。 利用 Overlay 類別並覆寫 onDraw (); ,可以在 MapView 上畫線。. 應用程式的權限管理. AndroidManifest.xml. 取得網路權限 取得 GPS 權限 取得網路定位權限. 宣告 使用

ailis
Download Presentation

GPS 軌跡紀錄

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. GPS軌跡紀錄 指導教授:李志清 學生姓名:陳振堃MA130226

  2. GPS軌跡紀錄 • 利用覆寫LocationListener的onLocationChanged();來追蹤目前的座標位置。 • 在偵測到Location座標變更時,利用GP1,GP2座標的不同,在MapView上畫線。 • 利用Overlay類別並覆寫onDraw(); ,可以在MapView上畫線。

  3. 應用程式的權限管理 AndroidManifest.xml 取得網路權限 取得GPS權限 取得網路定位權限 宣告使用 Google Maps Library

  4. 使用MapView 拖曳地圖

  5. 建立 MapActivity 引用<uses-library android:name="com.google.android.maps" /> 實作:isRouteDisplayed

  6. MapActivity

  7. getLoc()

  8. 狀態更新事件 • locMan.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 1000, 0, locLis); • locMan.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 0,locLis); • provider類型:LocationManager.GPS_PROVIDER; LocationManager.NETWORK_PROVIDER; • Time:進行週期性更新的時間 單位:毫秒。 • Distance:最小移動距離的回報 單位:公尺。 • looper:

  9. Start & End

  10. 實作LocationListener類別 直接實例化LocationManager是不允許的 locMan= (LocationManager)getSystemService(Context.LOCATION_SERVICE); 註冊一個周期性的更新 locMan.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 0, locLis;

  11. 獲 取 經 緯度

  12. 選擇合適的位置服務

  13. 添加覆蓋層

  14. ResetOverlay & RefreshMapView

  15. 創建一個新的覆蓋實例

  16. 繼承(com.google.android.maps.Overlay)

  17. 傳入 gp1, gp2, i

  18. 覆寫Draw()

  19. 覆寫Draw() shadow - 如果為true, 繪製陰影層。否則,繪製overlay的內容。

  20. E N D

More Related