android 系统定位
生活随笔
收集整理的這篇文章主要介紹了
android 系统定位
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
String[] perms = {Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION};
if (EasyPermissions.hasPermissions(MainActivity.this, perms)) {/*** NetWork定位*/LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);@SuppressLint("MissingPermission") Location location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);txt.setText("緯度:" + location.getLatitude() + "經度:" + location.getLongitude());Log.d("111111111",location.getLatitude() + "經度:" + location.getLongitude());} else {EasyPermissions.requestPermissions(this, "請開啟地圖權限,以正常使用", 0x11, perms);
}
demo?
總結
以上是生活随笔為你收集整理的android 系统定位的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: android 调用裁切板
- 下一篇: ARouter::Compiler N