android 自动定位时用 NETWORK_PROVIDER方式获取经纬度 NETWORK_PROVIDER方式如何获取经纬度呢?总是为null 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 联通的卡吧?2.3以下的API版本吧? to:guanwaterbighao是联通的3G卡, 是2.2的API, 请问跟服务商和API具体有什么关系呢? To: yangting_lisa程序onClick中如下:LocationManager locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);Location location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 2000, 0, locationListener);if (location != null) { double lat = location.getLatitude(); double lng = location.getLongitude();}监听器中为如下:private final LocationListener locationListener = new LocationListener() { public void onLocationChanged(Location location) { if (location != null) { double lat = location.getLatitude(); double lng = location.getLongitude(); } } }; 这个貌似和硬件以及系统有关系吧,我用htc的港行g20试过是可以的,用华为和moto defy则不行,有没有高手解释下是什么原因。 ScrollView中嵌入ViewPager,ViewPager的滑动出现问题 android上拉加载更多,下面的链接是要加载的数据json AlertDialog样式问题 android上的RIA应用 gridView点击后背景问题 如果在两个activity里面传递数值 Service与ContentProvide的多实例与多线程问题 HOME键,没有返回预期的效果。。帮忙查看原因!!! 求高手根据plist还原图片 菜鸟问个声明时的简单问题 怎么用一个软件来模拟android的多点触摸上报 求如下一整套图标,现在只有几个,不够用。谢谢!
是联通的3G卡, 是2.2的API, 请问跟服务商和API具体有什么关系呢?
程序onClick中如下:
LocationManager locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
Location location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 2000, 0, locationListener);
if (location != null) {
double lat = location.getLatitude();
double lng = location.getLongitude();
}
监听器中为如下:
private final LocationListener locationListener = new LocationListener() {
public void onLocationChanged(Location location) {
if (location != null) {
double lat = location.getLatitude();
double lng = location.getLongitude();
}
}
};