con-vicnet non con什么意思思

11500人阅读
&前言:最近在做一个应用,要用到LBS定位,本想自己写,可技术还是不到位,而且时间也不多了,还是以先实现为主吧,然后就研究百度的LBS定位,谷歌的也有LBS定位服务,但总感觉谷歌大神被赶到香港以后,就一直不稳定,不知道LBS怎么样,估计也不行,所以直接就用了百度定位SDK,但百度的定位SDK每日的最大访问量为10W,所以软件用户量大了的话,还是自己写定位代码吧,像我这样的前期用用也还无所谓,毕竟前期用户量不可能这么大的。
相关说明:
根据《百度定位SDK开发指南》,其中说到在V4.0以后都要申请KEY,但现在的KEY申请已经相当复杂了,变成了根应用相关的,奶奶个熊,我琢磨了好久也不知道申请的对不对,但我在程序中把KEY去掉,仍然是可以定位的,真不知道这是需要KEY还是不需要KEY。《指南》中说,地图初始化时用到KEY,可能这也说明在纯定位时,是不需要KEY的。既然不需要KEY,那么也就无法限定使用次数了。哈哈,好像我发现了什么。&既然不需要KEY,但源码是又要添加上SetKey()这句,而且论坛中很多人说设置KEY错误的问题(),我这运行机成功的很不踏实啊。=_=!!
一、相关资料
《百度定位SDK开发指南》:
《android使用百度定位SDK方法及错误处理》:&(这篇文章不错,将定位的接口封装成了一个类,直接调用就可以了)
《我的程序为什么不能定位》:
二、实现定位
<span style="color:#、导入库文件
在相关下载最新的库文件。将liblocSDK4.so文件拷贝到libs/armeabi目录下。将locSDK4.0.jar文件拷贝到工程的libs目录下,并在工程属性-&Java Build Path-&Libraries中选择“Add JARs”,选定locSDK4.0.jar,确定后返回。这样您就可以在程序中使用百度地理围栏SDK了。
<span style="color:#、设置AndroidManifest.xml
2.1. 在application标签中声明service组件,每个app拥有自己单独的定位service
&service android:name=&com.baidu.location.f& android:enabled=&true& android:process=&:remote&&&/service&
2.2 声明使用权限
&uses-permission android:name=&android.permission.ACCESS_COARSE_LOCATION&&&/uses-permission&&uses-permission android:name=&android.permission.ACCESS_FINE_LOCATION&&&/uses-permission&&uses-permission android:name=&android.permission.ACCESS_WIFI_STATE&&&/uses-permission&&uses-permission android:name=&android.permission.ACCESS_NETWORK_STATE&&&/uses-permission&&uses-permission android:name=&android.permission.CHANGE_WIFI_STATE&&&/uses-permission&&uses-permission android:name=&android.permission.READ_PHONE_STATE&&&/uses-permission&&uses-permission android:name=&android.permission.WRITE_EXTERNAL_STORAGE&&&/uses-permission&&uses-permission android:name=&android.permission.INTERNET& /&&uses-permission android:name=&android.permission.MOUNT_UNMOUNT_FILESYSTEMS&&&/uses-permission&&uses-permission android:name=&android.permission.READ_LOGS&&&/uses-permission&
<span style="color:#、XML内容
&RelativeLayout xmlns:android=&/apk/res/android&
xmlns:tools=&/tools&
android:layout_width=&match_parent&
android:layout_height=&match_parent&
android:paddingBottom=&@dimen/activity_vertical_margin&
android:paddingLeft=&@dimen/activity_horizontal_margin&
android:paddingRight=&@dimen/activity_horizontal_margin&
android:paddingTop=&@dimen/activity_vertical_margin&
tools:context=&.MainActivity& &
android:id=&@+id/textview&
android:layout_width=&fill_parent&
android:layout_height=&wrap_content&
android:textColor=&#ff00ff& &
&/TextView&
android:id=&@+id/ReLBS_button&
android:layout_width=&fill_parent&
android:layout_height=&wrap_content&
android:layout_below=&@+id/textview&
android:text=&重新定位&/&
&/RelativeLayout&
<span style="color:#、JAVA页面
package com.example.try_lbs_
* 尝试百度定位SDK
* @author harvic
import android.app.A
import android.os.B
import android.util.L
import android.view.V
import android.widget.B
import android.widget.TextV
import com.baidu.location.BDL
import com.baidu.location.BDLocationL
import com.baidu.location.LocationC
import com.baidu.location.LocationClientO
public class MainActivity extends Activity {
private TextView mTv =
public LocationClient mLocationClient =
public MyLocationListenner myListener = new MyLocationListenner();
public Button ReLBSButton=
public static String TAG = &msg&;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mTv = (TextView)findViewById(R.id.textview);
ReLBSButton=(Button)findViewById(R.id.ReLBS_button);
mLocationClient = new LocationClient( this );
/**——————————————————————————————————————————————————————————————————
* 这里的AK和应用签名包名绑定,如果使用在自己的工程中需要替换为自己申请的Key
* ——————————————————————————————————————————————————————————————————
mLocationClient.setAK(&697fcb6584d&);
mLocationClient.setAK(&z4nqERrqxnhNzT5VOGNVRt80&);
mLocationClient.registerLocationListener( myListener );
setLocationOption();//设定定位参数
mLocationClient.start();//开始定位
// 重新定位
ReLBSButton.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
if (mLocationClient != null && mLocationClient.isStarted())
mLocationClient.requestLocation();
Log.d(&msg&, &locClient is null or not started&);
//设置相关参数
private void setLocationOption(){
LocationClientOption option = new LocationClientOption();
option.setOpenGps(true);
option.setAddrType(&all&);//返回的定位结果包含地址信息
option.setCoorType(&bd09ll&);//返回的定位结果是百度经纬度,默认值gcj02
option.setScanSpan(5000);//设置发起定位请求的间隔时间为5000ms
option.disableCache(true);//禁止启用缓存定位
option.setPoiNumber(5);
//最多返回POI个数
option.setPoiDistance(1000); //poi查询距离
option.setPoiExtraInfo(true); //是否需要POI的电话和地址等详细信息
mLocationClient.setLocOption(option);
public void onDestroy() {
mLocationClient.stop();//停止定位
super.onDestroy();
* 监听函数,有更新位置的时候,格式化成字符串,输出到屏幕中
public class MyLocationListenner implements BDLocationListener {
//接收位置信息
public void onReceiveLocation(BDLocation location) {
if (location == null)
StringBuffer sb = new StringBuffer(256);
sb.append(&time : &);
sb.append(location.getTime());
sb.append(&\nreturn code : &);
sb.append(location.getLocType());
sb.append(&\nlatitude : &);
sb.append(location.getLatitude());
sb.append(&\nlontitude : &);
sb.append(location.getLongitude());
sb.append(&\nradius : &);
sb.append(location.getRadius());
if (location.getLocType() == BDLocation.TypeGpsLocation){
sb.append(&\nspeed : &);
sb.append(location.getSpeed());
sb.append(&\nsatellite : &);
sb.append(location.getSatelliteNumber());
} else if (location.getLocType() == BDLocation.TypeNetWorkLocation){
* 格式化显示地址信息
sb.append(&\naddr : &);
sb.append(location.getAddrStr());
sb.append(&\nsdk version : &);
sb.append(mLocationClient.getVersion());
sb.append(&\nisCellChangeFlag : &);
sb.append(location.isCellChangeFlag());
mTv.setText(sb.toString());
Log.i(TAG, sb.toString());
//接收POI信息函数,我不需要POI,所以我没有做处理
public void onReceivePoi(BDLocation poiLocation) {
if (poiLocation == null) {
基本步骤:
<span style="color:#、初始化:mLocationClient = new LocationClient( this );
2、设定监听函数,也就是说把结果返回后要怎么处理的函数:mLocationClient.registerLocationListener( myListener );
<span style="color:#、设定定位参数:setLocationOption();
<span style="color:#、开始定位:mLocationClient.start();
注意一点:
<span style="color:#、在开始定位之后,如果不调用mLocationClient.stop();来停止定位,那么程序会每隔几秒重新定位一次,非常浪费资源。为了验证这一点,我在程序中,在onReceiveLocation()函数中,使用Log.i(TAG, sb.toString());记录了每次接收到的位置信息并记录在LogCat中,下面是大概半小时后,也就是我写这篇文章的时间,“msg”标签的信息量竟然到了1777,可见程序定位了多少次!!!!!
&不知道怎么回事,刚才大约有一个小时定位都不成功,又返回errorCode:0;然后过了一段时间,自己又成功了,而且论坛里说有时定位准,有时定位不准,MY GOD,这百度到底行不行啊。这样时好时坏,搞得很不踏实啊。
附上errorCode&#20540;的含义吧,找了半天还是在论坛里找到的,使用说明中,根本没讲,哎,中国这些帮助文档啊,无语啦!!
百度基站定位错误返回码&
&61 : GPS定位结果
& 62 : 扫描整合定位依据失败。此时定位结果无效。
& 63 : 网络异常,没有成功向服务器发起请求。此时定位结果无效。
& 65 : 定位缓存的结果。
& 66 : 离线定位结果。通过requestOfflineLocaiton调用时对应的返回结果
& 67 : 离线定位失败。通过requestOfflineLocaiton调用时对应的返回结果
& 68 : 网络连接失败时,查找本地离线定位时对应的返回结果
& 161: 表示网络定位结果
& 162~167: 服务端定位失败。
&上源码吧:(不要分,紧供分享)
三、由经纬度计算两点间的距离
这种公式我当然是不知道的,百度下,代码公式啥啥的都有,直接用就OK,至于正确性嘛,应该是对的吧,这里记录一下
1.Lat1 Lung1&表示A点经纬度,Lat2 Lung2&表示B点经纬度;
2.a=Lat1&–&Lat2&为两点纬度之差&&b=Lung1 -Lung2&为两点经度之差;
3.为地球半径,单位为千米;
计算出来的结果单位为千米。
有人()从google map里面提取了计算代码,有验证的说是正确的,反正我是不会算的了,我的软件中也是用这段代码,如下
private const double EARTH_RADIUS = ;
private static double rad(double d)
return d * Math.PI / 180.0;
public static double GetDistance(double lat1, double lng1, double lat2, double lng2)
double radLat1 = rad(lat1);
double radLat2 = rad(lat2);
double a = radLat1 - radLat2;
double b = rad(lng1) - rad(lng2);
double s = 2 * Math.Asin(Math.Sqrt(Math.Pow(Math.Sin(a/2),2) +
Math.Cos(radLat1)*Math.Cos(radLat2)*Math.Pow(Math.Sin(b/2),2)));
s = s * EARTH_RADIUS;
s = Math.Round(s * 10000) / 10000;
}参考文献:《Android获取经纬度、计算距离、方位角》
转载请标明出处,谢谢,
版权声明:本文为博主原创文章,未经博主允许不得转载。
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:770753次
积分:8655
积分:8655
排名:第994名
原创:191篇
转载:35篇
评论:777条
新建了一个交流群,大家可以加入
想像一下当你想学一种知识,当你工作遇到瓶颈,当你无所适从……有没有想找一个领路人来指导自己。
我就是想做一个能找到领路人的网站,让它去辅助你完成你想做的事。
如果你有这方面的需要或者建议或者想参与的话,请加Q:
请让我听到你真实的声音。(其它勿加,谢谢)
(3)(3)(2)(1)(10)(7)(4)(6)(4)(7)(5)(15)(7)(4)(6)(7)(2)(10)(17)(4)(1)(3)(3)(7)(11)(15)(14)(7)(8)(6)(1)(5)(7)(14)Photographer:
Kristina Pedersen
Without further adieu, let us reintroduce Vic Mensa with his very digital new project #INNANETAPE. The 14-track album includes features and production from Chance The Rapper, Ab-Soul, Hit-Boy, Michael Uzowuru, DJ Dahi, Boi-1da, Cam and more. Big things ahead, when have we steered you wrong? Check out the tracklist, stream and/or download below.
01. Welcome to INNANET [Prod. by Vic Mensa. Additional prod. by Cam for J.U.S.T.I.C.E. League & Peter Cottontale]
02. Orange Soda [Prod. by Cam for J.U.S.T.I.C.E. League]
03. Lovely Day [Prod. by Vic Mensa & Peter Cottontale] 04.
05. FUN! (Interlude)
06. Magic (Ft. Jesse Boykins III) [Prod. by Peter Cottontale]
07. Time Is Money (Ft. Rockie Fresh) [Prod. by Boi-1nda & The Maven Boys]
08. YNSP (Ft. Eliza Doolittle) [Prod. by DJ Dahi]
09. Hollywood LA (Ft. Lili K) [Prod. by Cam for J.U.S.T.I.C.E. League & Tae Beast]
10. Holy Holy (Ft. Ab-Soul & BJ The Chicago Kid) [Prod. by Cam for J.U.S.T.I.C.E. League. Additional prod. by Peter Cottontale & Om'Mas Keith]
11. Fear & Doubt (Ft. Kenna & Joey Purp) [Prod. by Christian Rich]
12. Yap Yap [Prod. by Michael Uzowuru]
13. RUN! (Ft. Thundercat) [Prod. by Vic Mensa & Peter Cottontale. Additional prod. by Om'Mas Keith]
14. That Nigga [Prod. by Hit-Boy]
Look At This:
This is IllRoots
is property of illroots forever, llc 201313706人阅读
前言:这两天研究研究ViewPager滚动功能,现在很多的app都有用到这个功能,我们的大虾米也有这个模块。要研究就彻底的研究研究,我从不满足于一个功能只是简单的应用,要学就学的彻底,所以我打算将ViewPager 分几篇写,研究的哪个程度就写到哪个程度吧。今天是第一篇,基本入门篇&。相关文章:1、2、3、首先让大家有个全局的认识,直接上个项目,看看仅仅通过这几行代码,竟然就能完成如此强悍的功能。下篇再结合API仔细讲讲为什么要这么写。效果图:实现了三个view间的相互滑动& & & & & & & & & & &第一个VIEW向第二个VIEW滑动     &&第二个VIEW向第三个VIEW滑动&&&一、新建项目,引入ViewPager控件ViewPager。它是google SDk中自带的一个附加包的一个类,可以用来实现屏幕间的切换。1.在主布局文件里加入&RelativeLayout xmlns:android=&/apk/res/android&
xmlns:tools=&/tools&
android:layout_width=&fill_parent&
android:layout_height=&fill_parent&
tools:context=&com.example.testviewpage_1.MainActivity& &
&android.support.v4.view.ViewPager
android:id=&@+id/viewpager&
android:layout_width=&wrap_content&
android:layout_height=&wrap_content&
android:layout_gravity=&center& /&
&/RelativeLayout&其中&&android.support.v4.view.ViewPager /& 是2、新建三个layout,用于滑动切换的视图从效果图中也可以看到,我们的三个视图都非常简单,里面没有任何的控件,大家当然可以往里添加各种控件,但这里是个DEMO,只详解原理即可,所以我这里仅仅用背景来区别不用layout布局。布局代码分别如下:layout1.xml&?xml version=&1.0& encoding=&utf-8&?&
&LinearLayout xmlns:android=&/apk/res/android&
android:layout_width=&match_parent&
android:layout_height=&match_parent&
android:background=&#ffffff&
android:orientation=&vertical& &
&/LinearLayout&layout2.xml&?xml version=&1.0& encoding=&utf-8&?&
&LinearLayout xmlns:android=&/apk/res/android&
android:layout_width=&match_parent&
android:layout_height=&match_parent&
android:background=&#ffff00&
android:orientation=&vertical& &
&/LinearLayout&
layout3.xml&?xml version=&1.0& encoding=&utf-8&?&
&LinearLayout xmlns:android=&/apk/res/android&
android:layout_width=&match_parent&
android:layout_height=&match_parent&
android:background=&#ff00ff&
android:orientation=&vertical& &
&/LinearLayout&
二、代码实战先上整体代码,然后逐步讲解。package com.example.testviewpage_1;
import java.util.ArrayL
import java.util.L
import java.util.zip.I
import android.app.A
import android.os.B
import android.support.v4.view.PagerA
import android.support.v4.view.ViewP
import android.view.LayoutI
import android.view.V
import android.view.ViewG
public class MainActivity extends Activity {
private View view1, view2, view3;
private ViewPager viewP
//对应的viewPager
private List&View& viewL//view数组
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
viewPager = (ViewPager) findViewById(R.id.viewpager);
LayoutInflater inflater=getLayoutInflater();
view1 = inflater.inflate(R.layout.layout1, null);
view2 = inflater.inflate(R.layout.layout2,null);
view3 = inflater.inflate(R.layout.layout3, null);
viewList = new ArrayList&View&();// 将要分页显示的View装入数组中
viewList.add(view1);
viewList.add(view2);
viewList.add(view3);
PagerAdapter pagerAdapter = new PagerAdapter() {
public boolean isViewFromObject(View arg0, Object arg1) {
// TODO Auto-generated method stub
return arg0 == arg1;
public int getCount() {
// TODO Auto-generated method stub
return viewList.size();
public void destroyItem(ViewGroup container, int position,
Object object) {
// TODO Auto-generated method stub
container.removeView(viewList.get(position));
public Object instantiateItem(ViewGroup container, int position) {
// TODO Auto-generated method stub
container.addView(viewList.get(position));
return viewList.get(position);
viewPager.setAdapter(pagerAdapter);
}代码量很小,全部放在了OnCreate()函数中。1、先看声明的变量的意义:private View view1, view2, view3;
private List&View& viewL//view数组
private ViewPager viewP
//对应的viewPager首先viewPager对应&&android.support.v4.view.ViewPager/&控件。view1,view2 ,view3对应我们的三个layout,即layout1.xml,layout2.xml,layout3.xmlviewList是一个View数组,盛装上面的三个VIEW2、接下来是他们的初始化过程:viewPager = (ViewPager) findViewById(R.id.viewpager);
LayoutInflater inflater=getLayoutInflater();
view1 = inflater.inflate(R.layout.layout1, null);
view2 = inflater.inflate(R.layout.layout2,null);
view3 = inflater.inflate(R.layout.layout3, null);
viewList = new ArrayList&View&();// 将要分页显示的View装入数组中
viewList.add(view1);
viewList.add(view2);
viewList.add(view3);初始化过程难度不大,就是将资源与变量联系起来布局,最后将实例化的view1,view2,view3添加到viewList中3、PageAdapter——PageView的适配器适配器这个东东想必大家都不莫生,在ListView中也有适配器,listView通过重写GetView()函数来获取当前要加载的Item。而PageAdapter不太相同,毕竟PageAdapter是单个VIew的合集。PageAdapter 必须重写的四个函数:boolean isViewFromObject(View arg0, Object arg1)int getCount()&void destroyItem(ViewGroup container, int position,Object object)Object instantiateItem(ViewGroup container, int position)先看看各个函数,我们上面都做了什么吧:@Override
public int getCount() {
// TODO Auto-generated method stub
return viewList.size();
}getCount():返回要滑动的VIew的个数@Override
public void destroyItem(ViewGroup container, int position,
Object object) {
// TODO Auto-generated method stub
container.removeView(viewList.get(position));
destroyItem():从当前container中删除指定位置(position)的V@Override
public Object instantiateItem(ViewGroup container, int position) {
// TODO Auto-generated method stub
container.addView(viewList.get(position));
return viewList.get(position);
};instantiateItem():做了两件事,第一:将当前视图添加到container中,第二:返回当前View@Override
public boolean isViewFromObject(View arg0, Object arg1) {
// TODO Auto-generated method stub
return arg0 == arg1;
}isViewFromObject():对于这个函数就先不做讲解,大家目前先知道它要这样重写就行了,后面我们会对它进行改写。下一篇,我将仔细讲解这几个函数的意义,与有关Key的知识,当然最后也会有个例子给大家。这篇就到这了。源码地址:请大家尊重原创者版权,转载请标明出处: &万分感激!!!!!
版权声明:本文为博主原创文章,未经博主允许不得转载。
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:770755次
积分:8655
积分:8655
排名:第994名
原创:191篇
转载:35篇
评论:777条
新建了一个交流群,大家可以加入
想像一下当你想学一种知识,当你工作遇到瓶颈,当你无所适从……有没有想找一个领路人来指导自己。
我就是想做一个能找到领路人的网站,让它去辅助你完成你想做的事。
如果你有这方面的需要或者建议或者想参与的话,请加Q:
请让我听到你真实的声音。(其它勿加,谢谢)
(3)(3)(2)(1)(10)(7)(4)(6)(4)(7)(5)(15)(7)(4)(6)(7)(2)(10)(17)(4)(1)(3)(3)(7)(11)(15)(14)(7)(8)(6)(1)(5)(7)(14)Sotravic Limit&e
Sotravic Group - Annual Report for 2014
Despite tough market conditions, Sotravic continue to consolidate its market position and managed to post a turnover of Rs 1,49bn in 2014&
<img src="images/homepage/banner1-small-test.jpg" data-interchange="[images/homepage/banner1-small-test.jpg, (default)], [images/homepage/banner1-test.jpg, (only screen and (min-width: 1440px))]" alt="Today the company remains a privately
owned Mauritian civil and construction company.">
Today the company remains a privately
owned Mauritian civil and construction company.
By undertaking demolition and other civil engineering works and, spearheaded by its characteristic spirit of adventure, steadily embarked on projects of greater complexity.
Sotravic has completed over Rs 4bn of water infrastructure projects.
To date Sotravic installed over 600km of water pipeline infrastructure in all parts of Mauritius.
Sotravic has completed over Rs 7bn of sewer infrastructure projects.
To date Sotravic installed over 300km of sewerage infrastructure, including pumping stations and treatment plants.
3,3Mw Electricity plant produces 1% of Mauritius network distribution.
Sotravic became the first Independent Power Producer to supply, to the CEB, energy produced solely from a Renewable Source.
Sotravic entered the Solid Waste Management industry in 2006.
Sotravic receives and manages about 1200 tons of waste daily at Mare Chicose Landfill site of which Sotravic transports about 50%.
Sotravic is one of Mauritius&s leading Engineering, Contracting and Services companies. It has created employment, developed skills, applied technology and delivered infrastructure throughout Mauritius and Indian Ocean Islands. Careful step by step expansion in both resources and experience has enabled Sotravic to become the market leader in Sewer and Water infrastructure, Waste and Landfill management, Geotechnical investigation and Renewable Energy solutions. Today the Group focuses its operations in 3 sectors namely Water, Waste & Energy, Equipment & Logistics for both Public and Private clients.
Curepipe Road Works
Stop / Go active during weekdays on Gustave Colin and Royal Road from Pont Carbonnel to Mesnil from 9.00am until end of day.
Vacoas Road Works
Stop / Go active during weekdays on John Kennedy Ave from Thompson Road to La Touche Road and John Kennedy Ave from Nagapragassen Ave to La Tour Road from 9.00am until end of day.
Media / News
Build your career !
You want to be a member of our team,
and build a new and strong career.
Send us your curriculum vitae.

我要回帖

更多关于 con什么意思 的文章

 

随机推荐