public static Location getLocation(Context ctx) {
LocationManager lm = (LocationManager) ctx
.getSystemService(Context.LOCATION_SERVICE);
List<String> providers = lm.getProviders(true);
Location l = null;
for (int i = providers.size() - 1; i >= 0; i--) {
l = lm.getLastKnownLocation(providers.get(i));
if (l != null)
break;
}
return l;
}
获得坐标
原创
©著作权归作者所有:来自51CTO博客作者mb649166f4c151e的原创作品,请联系作者获取转载授权,否则将追究法律责任
上一篇:获得自己程序的版本
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
javascript获得鼠标的坐标
javascript获得鼠标的坐标
浏览器 计算机 javascript 客户端 动态