本文整理汇总了Java中com.tencent.map.geolocation.TencentLocationRequest类的典型用法代码示例。如果您正苦于以下问题:Java TencentLocationRequest类的具体用法?Java TencentLocationRequest怎么用?Java TencentLocationRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TencentLocationRequest类属于com.tencent.map.geolocation包,在下文中一共展示了TencentLocationRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: startLocation
import com.tencent.map.geolocation.TencentLocationRequest; //导入依赖的package包/类
private void startLocation() {
mLocationManager = TencentLocationManager.getInstance(this);
mLocationManager.setCoordinateType(TencentLocationManager.COORDINATE_TYPE_GCJ02);
mRefreshLayout.post(new Runnable() {
@Override
public void run() {
mRefreshLayout.setRefreshing(true);
}
});
TencentLocationRequest request = TencentLocationRequest.create()
// 设置定位周期
.setInterval(1000)
// 设置定位level
.setRequestLevel(TencentLocationRequest.REQUEST_LEVEL_ADMIN_AREA);
int result = mLocationManager.requestLocationUpdates(request, this);
if (result == 0) {
LogUtil.d(TAG, "start location");
} else {
LogUtil.d(TAG, "cannot start location! error: " + result);
}
}
开发者ID:garywzh,项目名称:SimpleWeather,代码行数:25,代码来源:MainActivity.java
示例2: startLocation
import com.tencent.map.geolocation.TencentLocationRequest; //导入依赖的package包/类
public void startLocation(View view) {
// 创建定位请求
TencentLocationRequest request = TencentLocationRequest.create();
// 修改定位请求参数, 定位周期 3000 ms
request.setInterval(3000);
Looper otherLooper = mThread.getLooper();
if (mIndex == BG_THREAD) {
// 开始定位, 在 mThread 线程中
mLocationManager.requestLocationUpdates(request, this, otherLooper);
} else if (mIndex == MAIN_THREAD) {
// 开始定位, 在主线程中
mLocationManager.requestLocationUpdates(request, this);
}
updateLocationStatus("开始定位: " + request + ", 坐标系="
+ DemoUtils.toString(mLocationManager.getCoordinateType()));
}
开发者ID:tencentlocation,项目名称:TencentLocationDemo,代码行数:20,代码来源:DemoThreadActivity.java
示例3: startLocation
import com.tencent.map.geolocation.TencentLocationRequest; //导入依赖的package包/类
public void startLocation(View view) {
if (!mStarted) {
mStarted = true;
// 创建定位请求
TencentLocationRequest request = TencentLocationRequest
.create()
.setRequestLevel(
TencentLocationRequest.REQUEST_LEVEL_ADMIN_AREA)
.setInterval(mInterval); // 设置定位周期, 建议值为 1s-20s
// 开始定位
mLocationManager.requestLocationUpdates(request, this);
updateLocationStatus("开始定位: " + request + ", 坐标系="
+ DemoUtils.toString(mLocationManager.getCoordinateType()));
}
}
开发者ID:tencentlocation,项目名称:TencentLocationDemo,代码行数:18,代码来源:DemoIntervalActivity.java
示例4: startLocation
import com.tencent.map.geolocation.TencentLocationRequest; //导入依赖的package包/类
public void startLocation(View view) {
// 创建定位请求
final TencentLocationRequest request = TencentLocationRequest.create();
// 修改定位请求参数, 定位周期 3000 ms
request.setInterval(3000);
// 在 mThread 线程发起定位
mHandler.post(new Runnable() {
@Override
public void run() {
mLocationManager.requestLocationUpdates(request,
DemoThreadActivity2.this);
}
});
updateLocationStatus("开始定位: " + request + ", 坐标系="
+ DemoUtils.toString(mLocationManager.getCoordinateType()));
}
开发者ID:tencentlocation,项目名称:TencentLocationDemo,代码行数:22,代码来源:DemoThreadActivity2.java
示例5: initView
import com.tencent.map.geolocation.TencentLocationRequest; //导入依赖的package包/类
@Override
public void initView() {
mBtnToolbarSend.setVisibility(View.VISIBLE);
setRlMapHeight(maxHeight);
mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
mOritationSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION);
mLocationManager = TencentLocationManager.getInstance(this);
mLocationRequest = TencentLocationRequest.create();
mTencentMap = mMap.getMap();
mTencentSearch = new TencentSearch(this);
}
开发者ID:starryxp,项目名称:LQRWeChat-master,代码行数:12,代码来源:MyLocationActivity.java
示例6: getDefaultLocationRequest
import com.tencent.map.geolocation.TencentLocationRequest; //导入依赖的package包/类
public static TencentLocationRequest getDefaultLocationRequest(){
if(locationRequest == null){
// 请求的位置信息包括经纬度,位置所处的中国大陆行政区划(REQUEST_LEVEL_ADMIN_AREA)
return TencentLocationRequest.create().setRequestLevel(TencentLocationRequest.REQUEST_LEVEL_ADMIN_AREA);
}
return locationRequest;
}
开发者ID:woniukeji,项目名称:jianguo,代码行数:8,代码来源:LocationUtil.java
示例7: onCreate
import com.tencent.map.geolocation.TencentLocationRequest; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TencentLocationRequest request = TencentLocationRequest.create();
TencentLocationManager locationManager = TencentLocationManager
.getInstance(this);
int error = locationManager.requestLocationUpdates(request, this);
Log.i("test",
"MainActivity, onCreate, locationManager.requestLocationUpdates returns "
+ error);
}
开发者ID:cheyiliu,项目名称:test4XXX,代码行数:14,代码来源:MainActivity.java
示例8: startLocation
import com.tencent.map.geolocation.TencentLocationRequest; //导入依赖的package包/类
public void startLocation() {
TencentLocationRequest request = TencentLocationRequest.create();
request.setInterval(1000);
int errorNo = mLocationManager.requestLocationUpdates(request, this);
if (errorNo == 2) {
System.out.println("Key����ȷ�����������ã�");
}
}
开发者ID:SuperMap,项目名称:iMobile_MessageQueue_Android,代码行数:9,代码来源:TencentLocation.java
示例9: startLocation
import com.tencent.map.geolocation.TencentLocationRequest; //导入依赖的package包/类
public void startLocation(View view) {
// 创建定位请求
TencentLocationRequest request = TencentLocationRequest.create()
.setInterval(5000) // 设置定位周期
.setRequestLevel(mLevel); // 设置定位level
// 开始定位
mLocationManager.requestLocationUpdates(request, this);
updateLocationStatus("开始定位: " + request + ", 坐标系="
+ DemoUtils.toString(mLocationManager.getCoordinateType()));
}
开发者ID:tencentlocation,项目名称:TencentLocationDemo,代码行数:13,代码来源:DemoLevelActivity.java
示例10: startLocation
import com.tencent.map.geolocation.TencentLocationRequest; //导入依赖的package包/类
private void startLocation() {
TencentLocationRequest request = TencentLocationRequest.create();
request.setInterval(5000);
mLocationManager.requestLocationUpdates(request, this);
mRequestParams = request.toString() + ", 坐标系="
+ DemoUtils.toString(mLocationManager.getCoordinateType());
}
开发者ID:tencentlocation,项目名称:TencentLocationDemo,代码行数:9,代码来源:DemoMapActivity.java
示例11: onCreate
import com.tencent.map.geolocation.TencentLocationRequest; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_direction);
mStatus = (TextView) findViewById(R.id.status);
mView = (DirectionView) findViewById(R.id.dir);
mLocationManager = TencentLocationManager.getInstance(this);
mLocationManager.requestLocationUpdates(TencentLocationRequest.create()
.setRequestLevel(TencentLocationRequest.REQUEST_LEVEL_GEO)
.setInterval(500).setAllowDirection(true), this);
}
开发者ID:tencentlocation,项目名称:TencentLocationDemo,代码行数:13,代码来源:DemoDirectionActivity.java
示例12: startLocation
import com.tencent.map.geolocation.TencentLocationRequest; //导入依赖的package包/类
public void startLocation(View view) {
// 创建定位请求
TencentLocationRequest request = TencentLocationRequest.create();
// 修改定位请求参数, 周期为 5000 ms
request.setInterval(5000);
// 开始定位
mLocationManager.requestLocationUpdates(request, this);
updateLocationStatus("开始定位: " + request + ", 坐标系="
+ DemoUtils.toString(mLocationManager.getCoordinateType()));
}
开发者ID:tencentlocation,项目名称:TencentLocationDemo,代码行数:15,代码来源:DemoStatusActivity.java
示例13: start
import com.tencent.map.geolocation.TencentLocationRequest; //导入依赖的package包/类
public void start(Runnable r) {
if (!mStarted) {
mStarted = true;
mTmp = r;
TencentLocationRequest request = TencentLocationRequest.create()
.setInterval(5000)
.setRequestLevel(TencentLocationRequest.REQUEST_LEVEL_GEO);
TencentLocationManager.getInstance(mContext)
.requestLocationUpdates(request, this);
}
}
开发者ID:tencentlocation,项目名称:TencentLocationDemo,代码行数:12,代码来源:LocationHelper.java
示例14: startLocation
import com.tencent.map.geolocation.TencentLocationRequest; //导入依赖的package包/类
public void startLocation(View view) {
// 创建定位请求
TencentLocationRequest request = TencentLocationRequest.create();
// 修改定位请求参数, 定位周期 3000 ms
request.setInterval(3000);
// 开始定位
mLocationManager.requestLocationUpdates(request, this);
updateLocationStatus("开始定位: " + request + ", 坐标系="
+ DemoUtils.toString(mLocationManager.getCoordinateType()));
}
开发者ID:tencentlocation,项目名称:TencentLocationDemo,代码行数:15,代码来源:DemoWgs84Activity.java
示例15: toString
import com.tencent.map.geolocation.TencentLocationRequest; //导入依赖的package包/类
private static String toString(TencentLocation location, int level) {
StringBuilder sb = new StringBuilder();
sb.append("latitude=").append(location.getLatitude()).append(",");
sb.append("longitude=").append(location.getLongitude()).append(",");
sb.append("altitude=").append(location.getAltitude()).append(",");
sb.append("accuracy=").append(location.getAccuracy()).append(",");
switch (level) {
case TencentLocationRequest.REQUEST_LEVEL_GEO:
break;
case TencentLocationRequest.REQUEST_LEVEL_NAME:
sb.append("name=").append(location.getName()).append(",");
sb.append("address=").append(location.getAddress()).append(",");
break;
case TencentLocationRequest.REQUEST_LEVEL_ADMIN_AREA:
case TencentLocationRequest.REQUEST_LEVEL_POI:
case 7:
sb.append("nation=").append(location.getNation()).append(",");
sb.append("province=").append(location.getProvince()).append(",");
sb.append("city=").append(location.getCity()).append(",");
sb.append("district=").append(location.getDistrict()).append(",");
sb.append("town=").append(location.getTown()).append(",");
sb.append("village=").append(location.getVillage()).append(",");
sb.append("street=").append(location.getStreet()).append(",");
sb.append("streetNo=").append(location.getStreetNo()).append(",");
if (level == TencentLocationRequest.REQUEST_LEVEL_POI) {
List<TencentPoi> poiList = location.getPoiList();
int size = poiList.size();
for (int i = 0, limit = 3; i < limit && i < size; i++) {
sb.append("\n");
sb.append("poi[" + i + "]=")
.append(toString(poiList.get(i))).append(",");
}
}
break;
default:
break;
}
return sb.toString();
}
开发者ID:tencentlocation,项目名称:TencentLocationDemo,代码行数:48,代码来源:DemoLevelActivity.java
注:本文中的com.tencent.map.geolocation.TencentLocationRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论