读书人

用network_provider得不到位置信息,该

发布时间: 2013-11-08 17:52:14 作者: rapoo

用network_provider得不到位置信息

locman1=(LocationManager)getSystemService(Context.LOCATION_SERVICE);

if (locman1.isProviderEnabled(LocationManager.NETWORK_PROVIDER)){
TextView textview;
textview=(TextView)findViewById(R.id.lng);
textview.setText("network:enable");
}


locman1.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, loclistener);
Location location=new Location("a");
location=locman1.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
if (location!=null){
TextView textview;
textview=(TextView)findViewById(R.id.lat);
textview.setText("lat:" +location.getLatitude());
}

该加的权限也都加了,咋就得不到啊
[解决办法]
在真机上试试
[解决办法]
日志信息贴出来.....
[解决办法]
log信息为日志信息

LocationManager.GPS应该是可以的
LocationManager.NETWORK_PROVIDER我也没取到
[解决办法]
我在虚拟机上测试过,network取不到,但GPS可以

读书人网 >Android

热点推荐