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中出现一次,第二个可能称为该关键字的值)的数据处理能力,由于这个特性,它完成有可能在我们处理一对一数据的时候 ...
随机推荐
- Codeforces Round #236 (Div. 2)E. Strictly Positive Matrix(402E)
E. Strictly Positive Matrix You have matrix a of size n × n. Let's number the rows of the matrix f ...
- eclipse 解决插件失效
昨天系统崩溃,重装系统后eclipse突然对links方式加载插件失效.用尽了网上各种解决方法,始终不行.在%eclispe_dir%/configration/org.eclipse.update/ ...
- INTELLIJ IDEA集成CHECKSTYLE(转)
转自:http://www.cnblogs.com/kiwi-wang/p/4166410.html 本文中使用intelliJ IDEA版本为14.0.1,其他版本差异不大,可同样安装. 下载安装C ...
- yii 分页 (ajax)
Controller:class MemberController extends Controller { public function actionmember_list() { ...
- Java 实现Md5算法
package other; import java.security.MessageDigest;import java.security.NoSuchAlgorithmException;/* * ...
- ios NSString 去除空格和回车
去除两端空格 NSString *temp = [textField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCh ...
- oracle递归函数
oracle start with connect by 使用方法 oracle中 connect by prior 递归算法 Oracle中start with...connect by prio ...
- 最新的四款国外VPN,免费稳定,可以看国外网站的
tyle="margin-top:20px; margin-right:0px; margin-bottom:0px; margin-left:0px; font-family:Arial; ...
- exit和abort都是用来终止程序的函数
exit会做一些释放工作:释放所有的静态的全局的对象,缓存,关掉所有的I/O通道,然后终止程序.如果有函数通过atexit来注册,还会调用注册的函数.不过,如果atexit函数扔出异常的话,就会直接调 ...
- Nginx的10万并发内核参数优化
关于内核参数的优化: net.ipv4.tcp_max_tw_buckets = 6000timewait的数量,默认是180000.net.ipv4.ip_local_port_range = 10 ...