private void getCurPos () {
mFusedLocationClient = LocationServices.getFusedLocationProviderClient(this);
mFusedLocationClient.getLastLocation()
.addOnSuccessListener(this, new OnSuccessListener<Location>() {
@Override
public void onSuccess(Location location) {
// Got last known location. In some rare situations this can be null.
if (location != null) {
start = new LatLng(location.getLatitude(), location.getLongitude());
if (info == null)
info = getAddress(MapsActivity2.this, location.getLatitude(), location.getLongitude());
moveToPosition();
}
}
})
.addOnFailureListener(this, new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText(MapsActivity2.this, "Check Your GPS or network", Toast.LENGTH_SHORT).show();
}
});
}
MapsActivity2.java 文件源码
java
阅读 28
收藏 0
点赞 0
评论 0
项目:Overkill
作者:
评论列表
文章目录