Android Map新用法:MapFragment应用
MapView ,MapActivity 这种的局限在于,必须要继承MapActivity,否则无法使用MapView,但是,MapFragment 这种的局限在于,必须要安装Google Play Service ,也就是说必须是原生rom。而且sdk要在12以上
1.MapView ,MapActivity 这种的局限在于,必须要继承MapActivity,否则无法使用MapView。纠结就在于此。但是,最新官网上已经弃用了这糟粕的MapActivity。
Version
1 of the Google Maps Android API as been officially deprecated as of
December 3rd, 2012. This means that from March 3rd, 2013 you will no
longer be able to request an API key for this version. No new features
will be added to Google Maps Android API v1. However, apps using v1 will
continue to work on devices. Existing and new developers are encouraged
to use Google Maps Android API v2.
2.MapFragment 这种的局限在于,必须要安装Google Play Service ,也就是说必须是原生rom。而且sdk要在12以上。我蛋疼了。
3.WebView 貌似很轻松的集成进来,但没有实践就木有发言权。
第一种方式我先略过了。大家都知道。说第二种,第三种会了再补上
MapFragment是刚出的google官方包,要集成进来还是挺麻烦的。官网链接 https://developers.google.com/maps/documentation/android/start
首
先要到google conlose 添加api access权限,拿到apikey,创建一个project
,然后到services里把Google Maps Android API v2打开,再到api
access里把你的project的keystore的SHA1和包名填进去,拿到唯一的api key
打开sdk
manager--在Extras里把Android Support Libaray 和 Google Play
Services都安装,lib和samples都在sdk_path/extra/google/google_play_services下。导
入../lib_project作为自己项目的libaray
这一步完了之后在manifest.xml文件里添加权限和api key。代码如下
<permission
android:name="com.example.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
com.example替换成自己project的package
<uses-permission android:name="com.example.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<!--My Location-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<!--Maps API needs OpenGL ES2..-->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
放在application声明里
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="appkey"/>
在layout xml里加入MapFragment声明
<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"/>
Android Map新用法:MapFragment应用的更多相关文章
- Android之Adapter用法总结-(转)
Android之Adapter用法总结 1.概念 Adapter是连接后端数据和前端显示的适配器接口,是数据和UI(View)之间一个重要的纽带.在常见的View(List View,Grid Vie ...
- Android之Adapter用法总结(转)
Android之Adapter用法总结 1.概念 Adapter是连接后端数据和前端显示的适配器接口,是数据和UI(View)之间一个重要的纽带.在常见的View(List View,Grid Vie ...
- Android webservice的用法详细讲解
Android webservice的用法详细讲解 看到有很多朋友对WebService还不是很了解,在此就详细的讲讲WebService,争取说得明白吧.此文章采用的项目是我毕业设计的webserv ...
- Android之Adapter用法总结
http://blog.csdn.net/fznpcy/article/details/8658155 Android之Adapter用法总结 1.概念 Adapter是连接后端数据和前端显示的适配器 ...
- xamarin android viewpager的用法
1.什么是ViewPager 通过手势滑动可以完成view的切换,一般是用来app的引导页或则实现图片轮播,类似网页上的banner轮播. Adnroid 3.0后引入的一个UI控件,在xamarin ...
- Android P新功能特性抢先看
2018年3月8日,Google推出了Android P Preview版本,并提供官方镜像下载. 为了让广大开发者能够及时了解Android P的新功能特性,提前为您的app进行良好适配,WeTes ...
- python map 常见用法
python map 常见用法2017年02月01日 19:32:41 淇怪君 阅读数:548版权声明:欢迎转载,转载请注明出处 https://blog.csdn.net/Tifficial/art ...
- forEach、for+i、map的用法及区别
array.forEach(callback[, thisObject]); 下面是参数的详细信息: 1. callback : 函数测试数组的每个元素. 2.thisObject : 对象作为该 ...
- STL 之 map的用法
Map是STL的一个关联容器,它提供一对一(其中第一个可以称为关键字,每个关键字只能在map中出现一次,第二个可能称为该关键字的值)的数据处理能力,由于这个特性,它完成有可能在我们处理一对一数据的时候 ...
随机推荐
- 黑马程序员_JavaIO流(二)
字符流的缓冲区 缓冲区的出现提高了对数据的读写效率. 对应类: BufferedWriter BufferedReader 缓冲区要结合流才可以使用. 在流的基础上对流的功能进行了增强. Buffer ...
- Maven Installation
OS:Ubuntu 14.04 Extract the distribution archive, i.e. apache-maven-3.2.2-bin.tar.gz to the director ...
- [HNOI 2013] 旅行 (数学)
感觉此题难啊,数学还是太渣了,看了半天的题解才算明白了点儿. 题目大意 给一个长度为n且仅由1和-1组成的序列ai, i = 1, 2, ..., n,每个位置都有另一个值vi,要求用某种方案将序列划 ...
- Appnium+python实现手势密码为什么总是报错
最近一直在尝试Appnium实现Android手机自动化测试,一直一直卡在一个点上,那就是手势密码,因为所测应用的手势密码使用的不是单个的imageview实现的手势密码解锁窗,所以只能靠坐标点来定位 ...
- 使用GULP打包、压缩与打版本号
这篇文章讲我整理的一种打包项目的方式,以下是我的依赖清单 "devDependencies": { "gulp": "^3.9.1", &q ...
- jqTransform——学习(1)
官网:http://www.dfc-e.com/metiers/multimedia/opensource/jqtransform/ 转载:http://www.helloweba.com/view- ...
- 【HPP开发】让所有中小企业拥有自己的APP
HPP hybirdApp或者hbuilderApp, 指通过html,css,js语言开发出ios和android两个版本的APP, 开发效率成倍上升,开发时间大幅缩减,开发成本同样也大大缩减. 移 ...
- form表单提交之前推断
1.使用onsubmit方法 <form name="Form" action="t" method="post" onsubmit= ...
- C++ operator关键字(重载操作符)(转)
operator是C++的关键字,它和运算符一起使用,表示一个运算符函数,理解时应将operator=整体上视为一个函数名. 这是C++扩展运算符功能的方法,虽然样子古怪,但也可以理解:一方面要使运算 ...
- ASP.NET静态页生成方法(模板替换)
本文实例讲述了ASP.NET静态页生成方法的一种简单方法,就是替换内容法. 适用场景 模板比较固定,页面替换内容较少. 基本原理 此方法中静态页生成用到的就是匹配跟替换了,首先得读取模板页的html内 ...