申请Google Map服务
要想使用Google Map,那么一定需要注册一个Google的通行证,注册地址:
https://accounts.google.com/ServiceLoginAuth。
如果要申请Goolge Map服务,那么必须生成一个MD5指纹码,而这个指纹码,可以
通过debug.keystore生成。
这个是一个签名的文件,对于所有的Android程序而已必须有此文件才可以打包编译,
而在一个Android虚拟机建立完成之后会自动的在一个目录中生成此文件,此目录一般为:
C:\Users\Administrator\.android
签名文件的有效期是1年,1年之后如果没有重新做系统,那么这个文件就无法再自动的
进行Android程序的打包操作,此时只能将此文件删除,之后会自动生成一个新的,这样
有可以继续使用1年。
每一台电脑都要申请属于自己的android:apiKey,要是使用别人的android:apiKey,
则地图只显示方格,不会有实际的地图出现,并且在Android虚拟机重建或者重装电脑的操作系统的时候
也要重新申请android:apiKey,关于如何申请,我在“申请Google Map服务”中已说得很详细。
申请Google Map Android API Key:
1、进入https://accounts.google.com/ServiceLoginAuth申请google通行证,
我申请得的账号为:liyewen1988@gmail.com;
2、生成证书指纹(MD5),执行: C:\Users\Administrator\.android,
执行: keytool -list -v -keystore debug.keystore,口令为: android,
我得到的MD5为: 17:5A:46:90:5F:B1:E2:37:DA:12:A0:B5:54:4C:19:56;
3、如果在第4歩输入MD5的地方没有显示出来,则找到本地的hosts文件,在C:\Windows\System32\drivers\etc
目录下,打开hosts文件(修改hosts文件需要管理员权限),往里面最底部加
入203.208.46.180 google-developers.appspot.com;
4、打开网址https://developers.google.com/android/maps-api-signup?hl=zh-CN;
5、在已经登录的情况下将MD5复制进My certificate's MD5 fingerprint中,再选择同意,最后选择生成;
6、将<com.google.android.maps.MapView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="0Pm9QrsSh_mwtc6rMyqZMRu71qFpIB51UXVWHmg"/>
复制出来,"0Pm9QrsSh_mwtc6rMyqZMRu71qFpIB51UXVWHmg"这个就是我们所需要拿到的。
新建一个地图项目。
在main.xml中:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.google.android.maps.MapView
android:clickable="true"
android:enabled="true"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="0Pm9QrsSh_mwtc6rMyqZMRu71qFpIB51UXVWHmg" />
</LinearLayout>
在MyGoogleMapDemo.java中:
package com.li.googlemapproject;
import android.os.Bundle;
import com.google.android.maps.MapActivity;
public class MyGoogleMapDemo extends MapActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.setContentView(R.layout.main);
}
@Override
protected boolean isRouteDisplayed() {
return false;
}
}
在AndroidManifest.xml中修改权限:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.li.googlemapproject"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MyGoogleMapDemo"
android:label="@string/title_activity_my_google_map_demo" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<uses-library android:name="com.google.android.maps" />
</application>
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
申请Google Map服务相关推荐
- Android使用Google Map服务 - 根据GPS信息在地图上定位
Android使用Google Map服务 - 根据GPS信息在地图上定位 自暑假7月7日开始,到今天的8月7日,整个一个月,我总算是学到了Google Map这部分的内容.原本挺兴奋的,却被注册ap ...
- 申请Google Map Android API Key
http://www.iteye.com/topic/1111863 要想使用Google的Map服务编写应用,无论是Google Map API和Google Map Android API都需要申 ...
- 申请google Map api key for android
申请android google map API key 1.首先找到debug keystore位置: 打开Eclipse--->Windows--->Preferences---> ...
- C# 根据地址调用 Google Map 服务得到经纬度
直接贴代码了: using System; using System.Collections.Generic; using System.IO; using System.Linq; using Sy ...
- google map api key申请
不会申请google map api key的童鞋看过来啊,看过来啊 以前玩的是百度地图,如今想玩谷歌地图,发现申请key有点小麻烦啊,但是一切都难不倒哥啊 首先大家进这个网站:https://cod ...
- 开发基于 Google Map 的 Android 应用
开发基于 Google Map 的 Android 应用 张 谦, 软件工程师, IBM 吴 校军, 高级软件工程师, IBM 苏 琳, 软件工程师, IBM 简介: 随着移动互联网应用的迅速发展,利 ...
- Google Map开发之实战
视频课:[免费]跨平台APP JQuery Mobile开发-1-初探移动开发-张晨光的在线视频教程-CSDN程序员研修院 学习内容 Google Map服务简介 获取Google Map API K ...
- android google map研究
2019独角兽企业重金招聘Python工程师标准>>> 研究了一天,最后居然卡在了获取本地位置上,不知道是不是我的G330D问题,反正网络位置是获取不了,看来得用百度地图试试,还是总 ...
- 判断手机是否支持google play服务
android开发报错 Unable to get provider com.google.firebase.provider.FirebaseInitProvider,classnotfound 或 ...
最新文章
- 计算公式1!+2!+3!+...+10!的和
- 从“没有免费的午餐”理论看机器学习模型
- php万年历上个月下个月,php 万年历
- 前大灯是近光灯还是远光灯_汽修案例:长安福特翼博前大灯间歇自动点亮
- 信号 09 | 函数pause
- 18个C/C++的基本知识点,带好小本子记录一下
- Spring Boot教程
- php 类 private,有关php类的private属性继承问题详解
- Flutter进阶—实现动画效果(四)
- php中系统函数的特征,老鸟需要知道的一些php系统类函数
- 黑苹果 无法运行xcode_Hackintosh (黑苹果) 折腾
- html文本绘制,HTML5绘制实心的文本
- rgb24转yuv420P
- install package vif包_Go Lang 开发笔记《Golang的包管理》
- css里的英文翻译,css常见英文翻译
- 推荐25种自媒体运营必备工具 (建议收藏)
- $.ajax传递数组的两种方式
- 前端进阶之javaScript
- 15-移动端布局基础——DPI、PPI、物理像素、DPR、viewportcss像素、DPR
- 持续集成之企业微信通知:5:在Jenkins中向企业微信推送消息