使用地址模拟了地图上的一个点
但是却在地图上看不到定位在这个点,并且使用 微信查找附近的人,却提示无法获取位置住处,代码如下
Criteria criteria = new Criteria(); // criteria.setAccuracy(Criteria.ACCURACY_FINE); String serviceName = Context.LOCATION_SERVICE; LocationManager locationManager = (LocationManager) getSystemService(serviceName); // String provider = locationManager.getBestProvider(criteria, true); if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { Log.d("provider", "gps enable"); } else { // locationManager.addTestProvider(LocationManager.GPS_PROVIDER, // false, false, // false, false, true, false, false, 0, 5); locationManager.addTestProvider(LocationManager.GPS_PROVIDER, "requiresNetwork" == "", "requiresSatellite" == "", "requiresCell" == "", "hasMonetaryCost" == "", "supportsAltitude" == "", "supportsSpeed" == "", "supportsBearing" == "", android.location.Criteria.POWER_LOW, android.location.Criteria.ACCURACY_FINE); locationManager.setTestProviderEnabled(LocationManager.GPS_PROVIDER, true); Log.d("provider", "add gps test provider "); } // listener = new LocationListener() { @Override public void onLocationChanged(Location location) { // TODO Auto-generated method stub Log.i("onLocationChanged", "come in"); if (location != null) { Log.w("Location", "Current altitude = " + location.getAltitude()); //altitude 地平纬度 Log.w("Location", "Current latitude = " + location.getLatitude()); //latitude } // locationManager.removeUpdates(this); // locationManager.setTestProviderEnabled(provider, false); } @Override public void onProviderDisabled(String provider) { // TODO Auto-generated method stub Log.i("onProviderDisabled", "come in"); } @Override public void onProviderEnabled(String provider) { // TODO Auto-generated method stub Log.i("onProviderEnabled", "come in"); } @Override public void onStatusChanged(String provider, int status, Bundle extras) { // TODO Auto-generated method stub Log.i("onStatusChanged", "come in"); } }; locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, (float) 1000.0,listener); Log.d("provider", "add location litersoner "); Location location = new Location(LocationManager.GPS_PROVIDER); location.setLatitude(22.575212D); //纬度 location.setLongitude(113.872068D); //经度 location.setAccuracy(16F); location.setAltitude(0D); location.setTime(System.currentTimeMillis()); location.setBearing(0F); try { Method makeComplete = Location.class.getMethod("makeComplete"); if (makeComplete != null) { makeComplete.invoke(location); Log.d("provider", "invoke "); } } catch (Exception e) { // Method only available in Jelly Bean } locationManager.setTestProviderLocation(locationManager.GPS_PROVIDER,location);
你好,我也碰到这个问题了,微信不能用模拟的地址,而且我把模拟定位开了,网络定位关了,微信还是不用我模拟的定位
你好 这个问题你的进展如何?为啥google mock pro能做呵
@wzp_124: →_→ 连我回复的你都问,,,我想想啊,,,我都忘了,我好像没再去实现,因为没意义了。这得看微信的定位是怎么获取的,烦了就不弄了,
我也遇到这个问题了 你们解决了么