Android程式調用本機google地圖

來源:互聯網
上載者:User
Android程式調用本機google地圖,傳遞起始和終點位置,產生路線圖

Android程式調用本機googlemap,傳遞起始和終點位置,產生路線圖
Android程式調用本機googlemap,傳遞起始和終點位置,產生路線圖

if (wodeweizhiPoint != null) {        if (wodeweizhiPoint.getLatitudeE6() != 0) {float chufajingdu = (float) (wodeweizhiPoint.getLongitudeE6() / 1E6);float chufaweidu = (float) (wodeweizhiPoint.getLatitudeE6() / 1E6);float daodajingdu = (float) (AppConstant.PointZuoBiao.liangxiangDaoHangPoint.getLongitudeE6() / 1E6);float daodaweidu = (float) (AppConstant.PointZuoBiao.liangxiangDaoHangPoint.getLatitudeE6() / 1E6);// 標記一個點// Intent i = new// Intent(Intent.ACTION_VIEW,Uri.parse("http://ditu.google.cn/maps?hl=zh&mrt=loc&q=31.249351,121.45905"));// 從哪到哪的路線Intent i = new Intent(Intent.ACTION_VIEW,Uri.parse("http://ditu.google.cn/maps?f=d&source=s_d&saddr="                        + chufaweidu        + ","+ chufajingdu+ "&daddr="+ daodaweidu+ ","+ daodajingdu + "&hl=zh"));//如果強制使用googlemap地圖用戶端開啟,就加下面兩句i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK& Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);i.setClassName("com.google.android.apps.maps","com.google.android.maps.MapsActivity");                startActivity(i);}} else {       AlertUtils.ToastAlert(mContext, “由於無法擷取到您的位置,所以暫時無法提供導航”);}

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.