는 내가 현재 위치를 트리거 할 Google지도 API에서 매 30 초
wanted add in this method
private void getCurrentLocation() {
//Creating a location object
if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return;
}
Location location = LocationServices.FusedLocationApi.getLastLocation(googleApiClient);
if (location != null) {
//Getting longitude and latitude
longitude = location.getLongitude();
latitude = location.getLatitude();
//moving the map to location
moveMap();
}
}
에 오신 것을 환영합니다, 간격이 방법을 실행하려고 할 경우 , 당신은 [ask]를 볼 수 있습니다. 더 구체적으로하려고하면 Google 서비스를 사용하여 GPS 위치를 원합니다. Google지도 API는지도 활동 만 제공합니다 (내가 틀린 것을 제외하고). – AxelH
또한, 우리가 가지고있는 것에서 대답하기 위해 LocationListener를 사용하여 매 30 초마다 자동으로 이벤트를 묻습니다. 등록 방법의 매개 변수 중 하나가 위치 사이의 시간. 이것은 더 많은 전력 효율이 될 것입니다. 이것은 Google 서비스를 사용하지 않을 것이고, 이것은 당신이 요청한 LocationListener만을 사용할 것입니다.하지만 이것은 – AxelH