示例#1
0
  @Override
  public void onCreate() {
    mLocationClient = new LocationClient(this);
    /**
     * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     * 宸戦議AK才哘喘禰兆淫兆鰯協�泌惚聞喘壓徭失議垢殻嶄俶勣紋算葎徭失賦萩議Key
     * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     */
    mLocationClient.setAK("697f50541f8d4779124896681cb6584d");
    mLocationClient.registerLocationListener(myListener);
    mGeofenceClient = new GeofenceClient(this);
    // 了崔戻佰�購旗鷹
    //		mNotifyer = new NotifyLister();
    //
    //	mNotifyer.SetNotifyLocation(40.047883,116.312564,3000,"gps");//4倖歌方旗燕勣了崔戻佰議泣議恫炎�醤悶根吶卆肝葎�粒業�将業�鉦宣袈律�恫炎狼窃侏(gcj02,gps,bd09,bd09ll)
    //		mLocationClient.registerNotify(mNotifyer);

    super.onCreate();
    Log.d(TAG, "... Application onCreate... pid=" + Process.myPid());
  }
示例#2
0
  public void clientInit() {
    // 初始化定位服务
    mLocationClient = new LocationClient(getApplicationContext());
    mLocationClient.setAK(accessKey);
    mLocationClient.registerLocationListener(myListener);
    LocationClientOption option = getLocationOption();
    mLocationClient.setLocOption(option);

    mLocationData = new LocationData();
    mLocationData.latitude = (double) (appData.lastLatitude) / 1E6;
    mLocationData.longitude = (double) (appData.lastLongitude) / 1E6;
    mLocationData.accuracy = appData.lastAccuracy;
    // 定位图层初始化
    myLocationOverlay = new MyLocationOverlay(mMapView);
    // 设置定位数据
    myLocationOverlay.setData(mLocationData);
    myLocationOverlay.setMarker(getResources().getDrawable(R.drawable.loading_point_medium));
    // 添加定位图层
    mMapView.getOverlays().add(myLocationOverlay);
    myLocationOverlay.enableCompass();
    // 修改定位数据后刷新图层生效
    mMapView.refresh();
  }