Google Maps Android API v2 android Google地圖v2

來源:互聯網
上載者:User


Getting the Google Maps Android API v2  目前google map api升級到了v3了 。v2流行中。至於v1已經標記為廢棄了。

 demo code位於 sdk extras/google/google_play_services/samples/maps 

Google Code
控制台地址

  1. 首先下載 google play service sdk。android sdk下載
  2.  擷取 API  key  跟v1有不同。注意
  3. Application Manifest 設定

 google 說 Note: The
Google Maps Android API v2 uses a new system of managing keys. Existing keys from a Google Maps Android v1 application, commonly known as MapView, will not work with the v2 API.  一代 二代的key系統不一樣,不通用

keytool  -v -list  -keystore key.keystore

 拷貝出 sha1 指紋



在控制台左側 點API Access.然後再頁面下方 Create New Android Key.. 把指紋拷貝進去:注意格式 “指紋;包名”


然後create 接下來

然後就拿到API key
接下來到mainfest.xml 中 


<meta-data    android:name="com.google.android.maps.v2.API_KEY"    android:value="your_api_key"/> 加入 加入必須的許可權        <permission          android:name="com.example.mapdemo.permission.MAPS_RECEIVE"          android:protectionLevel="signature"/>        <uses-permission android:name="com.example.mapdemo.permission.MAPS_RECEIVE"/><uses-permission android:name="android.permission.INTERNET"/><uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/><uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/><uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/><uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>v2 需要openGL 了 因此繼續添加<uses-feature  android:glEsVersion="0x00020000"  android:required="true"/>xml範例代碼<?xml version="1.0" encoding="utf-8"?><fragment xmlns:android="http://schemas.android.com/apk/res/android"  android:id="@+id/map"  android:layout_width="match_parent"  android:layout_height="match_parent"  class="com.google.android.gms.maps.MapFragment"/>

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.