本文整理汇总了Java中com.amap.api.maps.LocationSource类的典型用法代码示例。如果您正苦于以下问题:Java LocationSource类的具体用法?Java LocationSource怎么用?Java LocationSource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LocationSource类属于com.amap.api.maps包,在下文中一共展示了LocationSource类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: notifyLocationChanged
import com.amap.api.maps.LocationSource; //导入依赖的package包/类
@Override
public void notifyLocationChanged(LocationSource.OnLocationChangedListener amListener, AMapLocation aMapLocation) {
if(mGpsPowerListener != null){
mGpsPowerListener.onGpsPower(aMapLocation.getGpsAccuracyStatus());
}
for(ILocationFilter locationFilter : mLocationFilterList) {
if(!locationFilter.accept(mPrevoiusLocation, aMapLocation)){
return;
}
}
mPrevoiusLocation = aMapLocation;
amListener.onLocationChanged(aMapLocation);
if(mOnNewLocationListener != null){
mOnNewLocationListener.onNewLocation(aMapLocation);
}
}
示例2: activate
import com.amap.api.maps.LocationSource; //导入依赖的package包/类
/**
* 激活定位
*/
@Override
public void activate(LocationSource.OnLocationChangedListener listener) {
mListener = listener;
if (mAMapLocationManager == null) {
mAMapLocationManager = LocationManagerProxy.getInstance(this);
/*
* mAMapLocManager.setGpsEnable(false);
* 1.0.2版本新增方法,设置true表示混合定位中包含gps定位,false表示纯网络定位,默认是true Location
* API定位采用GPS和网络混合定位方式
* ,第一个参数是定位provider,第二个参数时间最短是2000毫秒,第三个参数距离间隔单位是米,第四个参数是定位监听者
*/
mAMapLocationManager.requestLocationUpdates(
LocationProviderProxy.AMapNetwork, 1000, 10, this);
}
}
示例3: activate
import com.amap.api.maps.LocationSource; //导入依赖的package包/类
/**
* 激活定位
*/
@Override
public void activate(LocationSource.OnLocationChangedListener listener) {
mListener = listener;
if (mAMapLocationManager == null) {
mAMapLocationManager = LocationManagerProxy.getInstance(this);
/*
* mAMapLocManager.setGpsEnable(false);
* 1.0.2版本新增方法,设置true表示混合定位中包含gps定位,false表示纯网络定位,默认是true Location
* API定位采用GPS和网络混合定位方式
* ,第一个参数是定位provider,第二个参数时间最短是2000毫秒,第三个参数距离间隔单位是米,第四个参数是定位监听者
*/
mAMapLocationManager.requestLocationUpdates(
LocationProviderProxy.AMapNetwork, 2000, 10, this);
}
}
示例4: onActivityCreated
import com.amap.api.maps.LocationSource; //导入依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
getMap().setLocationSource(new LocationSource() {
@Override
public void deactivate() {
mLocation = null;
}
@Override
public void activate(OnLocationChangedListener arg0) {
mLocation = arg0;
Location latest = MyLocationManager.getInstance().getLatestKnowLocation();
if(latest != null && mLocation != null){
mLocation.onLocationChanged(latest);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
MapUtil.moveToCurLocation(getMap());
}
});
}
}
});
getMap().setMapType(GlobelConstants.mapType);
MyLocationManager.getInstance().registLocationCallback(locationCallback);
MyLocationManager.getInstance().startListenLocation();
}
示例5: notifyLocationChanged
import com.amap.api.maps.LocationSource; //导入依赖的package包/类
void notifyLocationChanged(LocationSource.OnLocationChangedListener amListener, AMapLocation aMapLocation);