손장민

Current Location Editted

...@@ -5,7 +5,9 @@ import android.content.DialogInterface; ...@@ -5,7 +5,9 @@ import android.content.DialogInterface;
5 import android.content.Intent; 5 import android.content.Intent;
6 import android.content.pm.PackageManager; 6 import android.content.pm.PackageManager;
7 import android.location.Location; 7 import android.location.Location;
8 -import android.location.LocationListener; 8 +
9 +import com.google.android.gms.location.LocationListener;
10 +
9 import android.location.LocationManager; 11 import android.location.LocationManager;
10 import android.os.Build; 12 import android.os.Build;
11 import android.os.Bundle; 13 import android.os.Bundle;
...@@ -49,13 +51,10 @@ import com.google.android.gms.maps.model.MarkerOptions; ...@@ -49,13 +51,10 @@ import com.google.android.gms.maps.model.MarkerOptions;
49 * Created by HYB on 2017. 10. 11.. 51 * Created by HYB on 2017. 10. 11..
50 */ 52 */
51 53
52 -public class Map extends Fragment 54 +public class Map extends Fragment implements OnMapReadyCallback, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener
53 - implements OnMapReadyCallback ,
54 - GoogleApiClient.ConnectionCallbacks,
55 - GoogleApiClient.OnConnectionFailedListener,
56 - LocationListener
57 { 55 {
58 56
57 + private Location lastLocation;
59 private static final LatLng DEFAULT_LOCATION = new LatLng(37.56, 126.97); 58 private static final LatLng DEFAULT_LOCATION = new LatLng(37.56, 126.97);
60 private static final String TAG = "googlemap_example"; 59 private static final String TAG = "googlemap_example";
61 private static final int GPS_ENABLE_REQUEST_CODE = 2001; 60 private static final int GPS_ENABLE_REQUEST_CODE = 2001;
...@@ -79,12 +78,15 @@ public class Map extends Fragment ...@@ -79,12 +78,15 @@ public class Map extends Fragment
79 78
80 } 79 }
81 80
82 - public void setCurrentLocation(Location location, String markerTitle, String markerSnippet) { 81 + public void setCurrentLocation(Location location, String markerTitle, String markerSnippet)
83 - if ( currentMarker != null ) currentMarker.remove(); 82 + {
84 - 83 + if (currentMarker != null)
85 - if ( location != null) { 84 + { currentMarker.remove(); }
85 + if (location != null)
86 + {
87 + Log.i(TAG, " Got my Loc!! ");
86 //현재위치의 위도 경도 가져옴 88 //현재위치의 위도 경도 가져옴
87 - LatLng currentLocation = new LatLng( location.getLatitude(), location.getLongitude()); 89 + LatLng currentLocation = new LatLng(location.getLatitude(), location.getLongitude());
88 90
89 MarkerOptions markerOptions = new MarkerOptions(); 91 MarkerOptions markerOptions = new MarkerOptions();
90 markerOptions.position(currentLocation); 92 markerOptions.position(currentLocation);
...@@ -119,16 +121,18 @@ public class Map extends Fragment ...@@ -119,16 +121,18 @@ public class Map extends Fragment
119 @Override 121 @Override
120 public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) 122 public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
121 { 123 {
124 +
122 View layout = inflater.inflate(R.layout.map, container, false); 125 View layout = inflater.inflate(R.layout.map, container, false);
123 126
124 - mapView = (MapView)layout.findViewById(R.id.mapView); 127 + mapView = (MapView) layout.findViewById(R.id.mapView);
125 mapView.getMapAsync(this); 128 mapView.getMapAsync(this);
126 129
127 - PlaceAutocompleteFragment autocompleteFragment = (PlaceAutocompleteFragment) 130 + PlaceAutocompleteFragment autocompleteFragment = (PlaceAutocompleteFragment) getActivity().getFragmentManager().findFragmentById(R.id.place_autocomplete_fragment);
128 - getActivity().getFragmentManager().findFragmentById(R.id.place_autocomplete_fragment); 131 + autocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener()
129 - autocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() { 132 + {
130 @Override 133 @Override
131 - public void onPlaceSelected(Place place) { 134 + public void onPlaceSelected(Place place)
135 + {
132 Location location = new Location(""); 136 Location location = new Location("");
133 location.setLatitude(place.getLatLng().latitude); 137 location.setLatitude(place.getLatLng().latitude);
134 location.setLongitude(place.getLatLng().longitude); 138 location.setLongitude(place.getLatLng().longitude);
...@@ -137,7 +141,8 @@ public class Map extends Fragment ...@@ -137,7 +141,8 @@ public class Map extends Fragment
137 } 141 }
138 142
139 @Override 143 @Override
140 - public void onError(Status status) { 144 + public void onError(Status status)
145 + {
141 Log.i(TAG, "An error occurred: " + status); 146 Log.i(TAG, "An error occurred: " + status);
142 } 147 }
143 }); 148 });
...@@ -158,8 +163,8 @@ public class Map extends Fragment ...@@ -158,8 +163,8 @@ public class Map extends Fragment
158 super.onStop(); 163 super.onStop();
159 mapView.onStop(); 164 mapView.onStop();
160 165
161 - if ( googleApiClient != null && googleApiClient.isConnected()) 166 + if (googleApiClient != null && googleApiClient.isConnected())
162 - googleApiClient.disconnect(); 167 + { googleApiClient.disconnect(); }
163 } 168 }
164 169
165 @Override 170 @Override
...@@ -175,8 +180,8 @@ public class Map extends Fragment ...@@ -175,8 +180,8 @@ public class Map extends Fragment
175 super.onResume(); 180 super.onResume();
176 mapView.onResume(); 181 mapView.onResume();
177 182
178 - if ( googleApiClient != null) 183 + if (googleApiClient != null)
179 - googleApiClient.connect(); 184 + { googleApiClient.connect(); }
180 } 185 }
181 186
182 @Override 187 @Override
...@@ -185,10 +190,12 @@ public class Map extends Fragment ...@@ -185,10 +190,12 @@ public class Map extends Fragment
185 super.onPause(); 190 super.onPause();
186 mapView.onPause(); 191 mapView.onPause();
187 192
188 - if ( googleApiClient != null && googleApiClient.isConnected()) { 193 + if (googleApiClient != null && googleApiClient.isConnected())
189 - LocationServices.FusedLocationApi.removeLocationUpdates(googleApiClient, (com.google.android.gms.location.LocationListener) this); 194 + {
195 + LocationServices.FusedLocationApi.removeLocationUpdates(googleApiClient, this);
190 googleApiClient.disconnect(); 196 googleApiClient.disconnect();
191 } 197 }
198 +
192 } 199 }
193 200
194 @Override 201 @Override
...@@ -204,12 +211,14 @@ public class Map extends Fragment ...@@ -204,12 +211,14 @@ public class Map extends Fragment
204 super.onDestroy(); 211 super.onDestroy();
205 mapView.onLowMemory(); 212 mapView.onLowMemory();
206 213
207 - if ( googleApiClient != null ) { 214 + if (googleApiClient != null)
215 + {
208 googleApiClient.unregisterConnectionCallbacks(this); 216 googleApiClient.unregisterConnectionCallbacks(this);
209 googleApiClient.unregisterConnectionFailedListener(this); 217 googleApiClient.unregisterConnectionFailedListener(this);
210 218
211 - if ( googleApiClient.isConnected()) { 219 + if (googleApiClient.isConnected())
212 - LocationServices.FusedLocationApi.removeLocationUpdates(googleApiClient, (com.google.android.gms.location.LocationListener) this); 220 + {
221 + LocationServices.FusedLocationApi.removeLocationUpdates(googleApiClient, this);
213 googleApiClient.disconnect(); 222 googleApiClient.disconnect();
214 } 223 }
215 } 224 }
...@@ -220,6 +229,7 @@ public class Map extends Fragment ...@@ -220,6 +229,7 @@ public class Map extends Fragment
220 { 229 {
221 super.onActivityCreated(savedInstanceState); 230 super.onActivityCreated(savedInstanceState);
222 231
232 + Log.i(TAG, "An error occurred: onActivityCreated");
223 //액티비티가 처음 생성될 때 실행되는 함수 233 //액티비티가 처음 생성될 때 실행되는 함수
224 MapsInitializer.initialize(getActivity().getApplicationContext()); 234 MapsInitializer.initialize(getActivity().getApplicationContext());
225 235
...@@ -227,24 +237,26 @@ public class Map extends Fragment ...@@ -227,24 +237,26 @@ public class Map extends Fragment
227 { 237 {
228 mapView.onCreate(savedInstanceState); 238 mapView.onCreate(savedInstanceState);
229 } 239 }
240 + Log.i(TAG, "An error occurred: EndonActivityCreated");
230 } 241 }
231 242
232 @Override 243 @Override
233 public void onMapReady(GoogleMap googleMap) 244 public void onMapReady(GoogleMap googleMap)
234 { 245 {
235 -// 246 + //
236 -// LatLng SEOUL = new LatLng(37.56, 126.97); 247 + // LatLng SEOUL = new LatLng(37.56, 126.97);
237 -// MarkerOptions markerOptions = new MarkerOptions(); 248 + // MarkerOptions markerOptions = new MarkerOptions();
238 -// markerOptions.position(SEOUL); 249 + // markerOptions.position(SEOUL);
239 -// markerOptions.title("서울"); 250 + // markerOptions.title("서울");
240 -// markerOptions.snippet("수도"); 251 + // markerOptions.snippet("수도");
241 -// googleMap.addMarker(markerOptions); 252 + // googleMap.addMarker(markerOptions);
242 -// googleMap.moveCamera(CameraUpdateFactory.newLatLng(SEOUL)); 253 + // googleMap.moveCamera(CameraUpdateFactory.newLatLng(SEOUL));
243 -// googleMap.animateCamera(CameraUpdateFactory.zoomTo(13)); 254 + // googleMap.animateCamera(CameraUpdateFactory.zoomTo(13));
244 255
245 256
246 // OnMapReadyCallback implements 해야 mapView.getMapAsync(this); 사용가능. this 가 OnMapReadyCallback 257 // OnMapReadyCallback implements 해야 mapView.getMapAsync(this); 사용가능. this 가 OnMapReadyCallback
247 258
259 + Log.i(TAG, "An error occurred: onMapReady");
248 this.googleMap = googleMap; 260 this.googleMap = googleMap;
249 261
250 //런타임 퍼미션 요청 대화상자나 GPS 활성 요청 대화상자 보이기전에 지도의 초기위치를 서울로 이동 262 //런타임 퍼미션 요청 대화상자나 GPS 활성 요청 대화상자 보이기전에 지도의 초기위치를 서울로 이동
...@@ -256,117 +268,82 @@ public class Map extends Fragment ...@@ -256,117 +268,82 @@ public class Map extends Fragment
256 googleMap.animateCamera(CameraUpdateFactory.zoomTo(15)); 268 googleMap.animateCamera(CameraUpdateFactory.zoomTo(15));
257 269
258 // API 23 이상이면 런타임 퍼미션 처리 필요 270 // API 23 이상이면 런타임 퍼미션 처리 필요
259 - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { 271 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
272 + {
260 // 사용권한체크 273 // 사용권한체크
261 int hasFineLocationPermission = ContextCompat.checkSelfPermission(getActivity(), android.Manifest.permission.ACCESS_FINE_LOCATION); 274 int hasFineLocationPermission = ContextCompat.checkSelfPermission(getActivity(), android.Manifest.permission.ACCESS_FINE_LOCATION);
262 275
263 - if ( hasFineLocationPermission == PackageManager.PERMISSION_DENIED) { 276 + if (hasFineLocationPermission == PackageManager.PERMISSION_DENIED)
277 + {
264 //사용권한이 없을경우 278 //사용권한이 없을경우
265 //권한 재요청 279 //권한 재요청
266 ActivityCompat.requestPermissions(getActivity(), new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION}, PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION); 280 ActivityCompat.requestPermissions(getActivity(), new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION}, PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION);
267 - } else { 281 + }
282 + else
283 + {
268 //사용권한이 있는경우 284 //사용권한이 있는경우
269 - if ( googleApiClient == null) { 285 + if (googleApiClient == null)
286 + {
270 buildGoogleApiClient(); 287 buildGoogleApiClient();
271 } 288 }
272 289
273 - if ( ActivityCompat.checkSelfPermission(getActivity(), android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) 290 + if (ActivityCompat.checkSelfPermission(getActivity(), android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED)
274 { 291 {
275 googleMap.setMyLocationEnabled(true); 292 googleMap.setMyLocationEnabled(true);
276 } 293 }
277 } 294 }
278 - } else { 295 + }
296 + else
297 + {
279 298
280 - if ( googleApiClient == null) { 299 + if (googleApiClient == null)
300 + {
281 buildGoogleApiClient(); 301 buildGoogleApiClient();
282 } 302 }
283 303
284 googleMap.setMyLocationEnabled(true); 304 googleMap.setMyLocationEnabled(true);
285 } 305 }
286 306
307 + Log.i(TAG, "An error occurred: ENDonMapReady");
287 308
288 } 309 }
289 310
290 private void buildGoogleApiClient() 311 private void buildGoogleApiClient()
291 { 312 {
292 - googleApiClient = new GoogleApiClient.Builder(getActivity()) 313 + Log.i(TAG, "An error occurred: buildGoogleApiClient");
293 - .addConnectionCallbacks(this) 314 + googleApiClient = new GoogleApiClient.Builder(getActivity()).addConnectionCallbacks(this).addOnConnectionFailedListener(this).addApi(LocationServices.API).addApi(Places.GEO_DATA_API).addApi(Places.PLACE_DETECTION_API).enableAutoManage(getActivity(), this).build();
294 - .addOnConnectionFailedListener(this)
295 - .addApi(LocationServices.API)
296 - .addApi(Places.GEO_DATA_API)
297 - .addApi(Places.PLACE_DETECTION_API)
298 - .enableAutoManage(getActivity(), this)
299 - .build();
300 googleApiClient.connect(); 315 googleApiClient.connect();
316 + Log.i(TAG, "An error occurred: ENDbuildGoogleApiClient");
301 } 317 }
302 318
303 - public boolean checkLocationServicesStatus() { 319 + public boolean checkLocationServicesStatus()
304 - LocationManager locationManager = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE);
305 -
306 - return locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER) ||
307 - locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
308 - }
309 - @Override
310 - public void onLocationChanged(Location location)
311 - {
312 - Log.i(TAG, "onLocationChanged call..");
313 - searchCurrentPlaces();
314 - }
315 -
316 - private void searchCurrentPlaces()
317 { 320 {
321 + Log.i(TAG, "An error occurred: checkLocationServicesStatus");
318 322
319 - @SuppressWarnings("MissingPermission") PendingResult<PlaceLikelihoodBuffer> result = Places.PlaceDetectionApi 323 + LocationManager locationManager = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE);
320 - .getCurrentPlace(googleApiClient, null);
321 - result.setResultCallback(new ResultCallback<PlaceLikelihoodBuffer>(){
322 -
323 - @Override
324 - public void onResult(@NonNull PlaceLikelihoodBuffer placeLikelihoods) {
325 - int i = 0;
326 - LikelyPlaceNames = new String[MAXENTRIES];
327 - LikelyAddresses = new String[MAXENTRIES];
328 - LikelyAttributions = new String[MAXENTRIES];
329 - LikelyLatLngs = new LatLng[MAXENTRIES];
330 -
331 - for(PlaceLikelihood placeLikelihood : placeLikelihoods) {
332 - LikelyPlaceNames[i] = (String) placeLikelihood.getPlace().getName();
333 - LikelyAddresses[i] = (String) placeLikelihood.getPlace().getAddress();
334 - LikelyAttributions[i] = (String) placeLikelihood.getPlace().getAttributions();
335 - LikelyLatLngs[i] = placeLikelihood.getPlace().getLatLng();
336 -
337 - i++;
338 - if(i > MAXENTRIES - 1 ) {
339 - break;
340 - }
341 - }
342 -
343 - placeLikelihoods.release();
344 -
345 - Location location = new Location("");
346 - location.setLatitude(LikelyLatLngs[0].latitude);
347 - location.setLongitude(LikelyLatLngs[0].longitude);
348 -
349 - setCurrentLocation(location, LikelyPlaceNames[0], LikelyAddresses[0]);
350 - }
351 - });
352 -
353 - }
354 -
355 - @Override
356 - public void onStatusChanged(String provider, int status, Bundle extras)
357 - {
358 324
325 + Log.i(TAG, "An error occurred: ENDcheckLocationServicesStatus");
326 + return locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER) || locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
359 } 327 }
360 328
361 @Override 329 @Override
362 - public void onProviderEnabled(String provider) 330 + public void onLocationChanged(Location location)
363 { 331 {
332 + Log.i(TAG, "onLocationChanged call..");
333 + lastLocation = location;
334 + if(currentMarker != null)
335 + {
336 + currentMarker .remove();
337 + }
338 + LatLng mlanglang = new LatLng(location.getLatitude(), location.getLongitude());
339 + MarkerOptions markerOptions = new MarkerOptions();
340 + markerOptions.position(mlanglang);
341 + markerOptions.title("Current Location");
342 + markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED));
364 343
365 - } 344 + currentMarker = googleMap.addMarker(markerOptions);
366 - 345 + googleMap.moveCamera(CameraUpdateFactory.newLatLng(mlanglang));
367 - @Override 346 + googleMap.animateCamera(CameraUpdateFactory.zoomBy(10));
368 - public void onProviderDisabled(String provider)
369 - {
370 347
371 } 348 }
372 349
...@@ -374,71 +351,79 @@ public class Map extends Fragment ...@@ -374,71 +351,79 @@ public class Map extends Fragment
374 public void onConnected(@Nullable Bundle bundle) 351 public void onConnected(@Nullable Bundle bundle)
375 { 352 {
376 353
377 - if ( !checkLocationServicesStatus()) { 354 + Log.i(TAG, "An error occurred: onConnected");
355 + if (!checkLocationServicesStatus())
356 + {
378 AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); 357 AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
379 builder.setTitle("위치 서비스 비활성화"); 358 builder.setTitle("위치 서비스 비활성화");
380 - builder.setMessage("앱을 사용하기 위해서는 위치 서비스가 필요합니다.\n" + 359 + builder.setMessage("앱을 사용하기 위해서는 위치 서비스가 필요합니다.\n" + "위치 설정을 수정하십시오.");
381 - "위치 설정을 수정하십시오.");
382 builder.setCancelable(true); 360 builder.setCancelable(true);
383 - builder.setPositiveButton("설정", new DialogInterface.OnClickListener() { 361 + builder.setPositiveButton("설정", new DialogInterface.OnClickListener()
362 + {
384 @Override 363 @Override
385 - public void onClick(DialogInterface dialogInterface, int i) { 364 + public void onClick(DialogInterface dialogInterface, int i)
386 - Intent callGPSSettingIntent = 365 + {
387 - new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); 366 + Intent callGPSSettingIntent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
388 startActivityForResult(callGPSSettingIntent, GPS_ENABLE_REQUEST_CODE); 367 startActivityForResult(callGPSSettingIntent, GPS_ENABLE_REQUEST_CODE);
389 } 368 }
390 }); 369 });
391 - builder.setNegativeButton("취소", new DialogInterface.OnClickListener(){ 370 + builder.setNegativeButton("취소", new DialogInterface.OnClickListener()
371 + {
392 @Override 372 @Override
393 - public void onClick(DialogInterface dialogInterface, int i) { 373 + public void onClick(DialogInterface dialogInterface, int i)
374 + {
394 dialogInterface.cancel(); 375 dialogInterface.cancel();
395 } 376 }
396 }); 377 });
397 builder.create().show(); 378 builder.create().show();
398 } 379 }
399 380
381 + Log.i(TAG, "An error occurred: onConnected2");
400 LocationRequest locationRequest = new LocationRequest(); 382 LocationRequest locationRequest = new LocationRequest();
401 locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); 383 locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
402 locationRequest.setInterval(UPDATE_INTERVAL_MS); 384 locationRequest.setInterval(UPDATE_INTERVAL_MS);
403 locationRequest.setFastestInterval(FASTEST_UPDATE_INTERVAL_MS); 385 locationRequest.setFastestInterval(FASTEST_UPDATE_INTERVAL_MS);
404 386
405 - if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { 387 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
406 - if ( ActivityCompat.checkSelfPermission(getActivity(), 388 + {
407 - android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { 389 + if (ActivityCompat.checkSelfPermission(getActivity(), android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED)
390 + {
408 391
409 - LocationServices.FusedLocationApi 392 + LocationServices.FusedLocationApi.requestLocationUpdates(googleApiClient, locationRequest, this);
410 - .requestLocationUpdates(googleApiClient, locationRequest, (com.google.android.gms.location.LocationListener) this);
411 } 393 }
412 - } else { 394 + }
413 - LocationServices.FusedLocationApi 395 + else
414 - .requestLocationUpdates(googleApiClient, locationRequest, (com.google.android.gms.location.LocationListener) this); 396 + {
397 + LocationServices.FusedLocationApi.requestLocationUpdates(googleApiClient, locationRequest, this);
415 398
416 this.googleMap.getUiSettings().setCompassEnabled(true); 399 this.googleMap.getUiSettings().setCompassEnabled(true);
417 this.googleMap.animateCamera(CameraUpdateFactory.zoomTo(15)); 400 this.googleMap.animateCamera(CameraUpdateFactory.zoomTo(15));
418 } 401 }
419 402
403 + Log.i(TAG, "An error occurred: onConnected3");
404 +
420 } 405 }
421 406
422 @Override 407 @Override
423 public void onConnectionSuspended(int i) 408 public void onConnectionSuspended(int i)
424 { 409 {
425 - if ( i == CAUSE_NETWORK_LOST ) 410 + if (i == CAUSE_NETWORK_LOST)
426 - Log.e(TAG, "onConnectionSuspended(): Google Play services " + 411 + { Log.e(TAG, "onConnectionSuspended(): Google Play services " + "connection lost. Cause: network lost."); }
427 - "connection lost. Cause: network lost."); 412 + else if (i == CAUSE_SERVICE_DISCONNECTED)
428 - else if (i == CAUSE_SERVICE_DISCONNECTED ) 413 + { Log.e(TAG, "onConnectionSuspended(): Google Play services " + "connection lost. Cause: service disconnected"); }
429 - Log.e(TAG,"onConnectionSuspended(): Google Play services " +
430 - "connection lost. Cause: service disconnected");
431 414
432 } 415 }
433 416
434 @Override 417 @Override
435 public void onConnectionFailed(@NonNull ConnectionResult connectionResult) 418 public void onConnectionFailed(@NonNull ConnectionResult connectionResult)
436 { 419 {
420 +
421 + Log.i(TAG, "An error occurred: onConnectionFailed");
437 Location location = new Location(""); 422 Location location = new Location("");
438 location.setLatitude(DEFAULT_LOCATION.latitude); 423 location.setLatitude(DEFAULT_LOCATION.latitude);
439 location.setLongitude((DEFAULT_LOCATION.longitude)); 424 location.setLongitude((DEFAULT_LOCATION.longitude));
440 425
441 - setCurrentLocation(location, "위치정보 가져올 수 없음", 426 + setCurrentLocation(location, "위치정보 가져올 수 없음", "위치 퍼미션과 GPS활성 여부 확인");
442 - "위치 퍼미션과 GPS활성 여부 확인"); 427 + Log.i(TAG, "An error occurred: ENDonConnectionFailed");
443 } 428 }
444 } 429 }
......