• 大小: 1.41M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2020-12-24
  • 语言: Java
  • 标签: 定位  百度地图  

资源简介

百度地图定位实例

目前该实例实现了 获取当前坐标以及具体位置的功能,但是 会不停的 获取gps位置,这是百度sdk的问题

解决方法是:


//读取当前坐标
         final LocationClient mLocationClient = new LocationClient(mActivity);
         mLocationClient.setLocOption(GPSUtil.GetOnceOption());
         mLocationClient.registerLocationListener( new BDLocationListener() {
                
                @Override
                public void onReceiveLocation(BDLocation location) {
                    // TODO Auto-generated method stub
                    if(location!=null){
                        longitude=location.getLongitude();
                        latitude=location.getLatitude();
                    }
//这里是你取得经纬度后执行的业务逻辑操作
//....
                    //几秒钟之后自动停止获取gps
                    new Handler().postDelayed(new Runnable() {  
                        @Override  
                        public void run() {  
                            mLocationClient.stop();
//                            PromptUtil.showLongToast(mActivity, Longitude "");
                        }  
              
                    }, 1*1000);  
                }
            } ); 
            mLocationClient.start();
            if (mLocationClient != null && mLocationClient.isStarted())
            mLocationClient.requestLocation();


资源截图

代码片段和文件信息

/** Automatically generated file. DO NOT MODIFY */
package com.example.bdlocationtest;

public final class BuildConfig {
    public final static boolean DEBUG = true;
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-05-31 15:15  bdlocationtest\
     文件         494  2015-05-31 15:19  bdlocationtest\.classpath
     文件         850  2015-05-31 15:15  bdlocationtest\.project
     目录           0  2015-05-31 15:15  bdlocationtest\.settings\
     文件         177  2015-05-31 15:15  bdlocationtest\.settings\org.eclipse.jdt.core.prefs
     文件        3021  2015-05-31 15:41  bdlocationtest\AndroidManifest.xml
     目录           0  2015-06-02 09:36  bdlocationtest\assets\
     目录           0  2015-05-31 22:14  bdlocationtest\bin\
     文件        3021  2015-05-31 15:41  bdlocationtest\bin\AndroidManifest.xml
     文件      296704  2015-05-31 22:14  bdlocationtest\bin\bdlocationtest.apk
     目录           0  2015-05-31 15:19  bdlocationtest\bin\classes\
     目录           0  2015-05-31 15:19  bdlocationtest\bin\classes\com\
     目录           0  2015-05-31 15:19  bdlocationtest\bin\classes\com\example\
     目录           0  2015-05-31 15:19  bdlocationtest\bin\classes\com\example\bdlocationtest\
     文件         361  2015-05-31 15:19  bdlocationtest\bin\classes\com\example\bdlocationtest\BuildConfig.class
     文件         364  2015-06-01 16:47  bdlocationtest\bin\classes\com\example\bdlocationtest\R$attr.class
     文件         485  2015-06-01 16:47  bdlocationtest\bin\classes\com\example\bdlocationtest\R$dimen.class
     文件         431  2015-06-01 16:47  bdlocationtest\bin\classes\com\example\bdlocationtest\R$drawable.class
     文件         450  2015-06-01 16:47  bdlocationtest\bin\classes\com\example\bdlocationtest\R$id.class
     文件         427  2015-06-01 16:47  bdlocationtest\bin\classes\com\example\bdlocationtest\R$layout.class
     文件         412  2015-06-01 16:47  bdlocationtest\bin\classes\com\example\bdlocationtest\R$menu.class
     文件         496  2015-06-01 16:47  bdlocationtest\bin\classes\com\example\bdlocationtest\R$string.class
     文件         455  2015-06-01 16:47  bdlocationtest\bin\classes\com\example\bdlocationtest\R$style.class
     文件         753  2015-06-01 16:47  bdlocationtest\bin\classes\com\example\bdlocationtest\R.class
     目录           0  2015-05-31 15:19  bdlocationtest\bin\classes\com\study\
     目录           0  2015-05-31 15:26  bdlocationtest\bin\classes\com\study\bdlocationtest\
     文件        2345  2015-05-31 22:21  bdlocationtest\bin\classes\com\study\bdlocationtest\LocationApplication$MyLocationListener.class
     文件        1512  2015-05-31 22:21  bdlocationtest\bin\classes\com\study\bdlocationtest\LocationApplication.class
     文件        2256  2015-05-31 22:13  bdlocationtest\bin\classes\com\study\bdlocationtest\MainActivity.class
     文件      707200  2015-05-31 22:14  bdlocationtest\bin\classes.dex
     目录           0  2015-05-31 15:32  bdlocationtest\bin\dexedLibs\
............此处省略59个文件信息

评论

共有 条评论