안드로이드에서 현재 위치를 얻는 방법과 현재 위치와 터치 한 위치 사이의 경로 또는 선을 그립니다.Google지도 현재 위치 확인 및 경로 그릴
-2
A
답변
1
현재 위치를 알고 싶으면 현재 loacation의 위도와 경도를 알아야합니다.
public void getLatiLongi()
{
LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
if (location != null) {
flati = location.getLatitude();
flongi = location.getLongitude();
System.out.println("Hello....................+lati+longi");
}
}
@Override
protected void onStart() {
super.onStart();
LocationManager locationManager =
(LocationManager) getSystemService(Context.LOCATION_SERVICE);
final boolean gpsEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
if (!gpsEnabled) {
gpsAlert();
}
}
public void gpsAlert(){
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
alertDialogBuilder.setTitle("Enable GPS");
alertDialogBuilder
.setMessage("Yes")
.setCancelable(false)
.setPositiveButton("Yes",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id) {
enableLocationSettings();
dialog.cancel();
}
})
.setNegativeButton("No",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id) {
dialog.cancel();
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
}
private void enableLocationSettings() {
Intent settingsIntent = new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(settingsIntent);
}
그 후 마커
https://developers.google.com/maps/documentation/android/marker를 사용합니다.
목적지의 위도와 경도가 필요합니다.
https://developers.google.com/maps/documentation/android/shapes#polylines.
사용 폴리 라인은 대상
Answer : Draw path between two points using Google Maps Android API v2에 위치에서 경로를 그립니다. 이 링크는 주제에 대한 좋은 설명이됩니다.
+0
thx 나는 그것을 시험해 볼 것이다. –
관련 문제
- 1. Google지도 이미지에 현재 위치를 그릴 방법
- 2. Google지도 Android API v2 및 현재 위치
- 3. Google지도 현재 위치 가져 오기
- 4. 현재 위치 경로 유형을 확인하십시오
- 5. iphone 앱의 Google지도 : 현재 위치
- 6. Google지도 - 현재 위치 - no HTML5
- 7. 마커 현재 위치 android Google지도?
- 8. Mapview 경로 경로를 그릴
- 9. Google지도 및 정확한 위치
- 10. 위치 서비스가있는 Google지도 API v3 경로 지정
- 11. 안드로이드 || 현재 Google지도 경로 정보 가져 오기
- 12. iPhone Google지도 및 GPS 위치
- 13. Google지도 V2 현재 위치 솔루션이 만료되었습니다.
- 14. 현재 위치 제목 및 자막 설정 - Google지도 SDK IOS
- 15. iPhone Google지도 API V3 사용자 현재 위치 및 쇼 레스토랑
- 16. Google지도 V2에서 경로를 그릴 수 없습니까?
- 17. Google지도 API : 착색 위치
- 18. 길 찾기 (경로) 및 거리가있는 이오닉 Google지도
- 19. Google지도 위치 및 API 사용
- 20. Google지도 API 및 표시 위치
- 21. 현재 위치를 기반으로 Google지도 v2에 그릴 수 없습니다.
- 22. 현재 위치 및 경로 추적 요구 사항 문제
- 23. Mongodb 부모 참조 트리 현재 위치 및 전체 경로 얻기
- 24. JSP에서 현재 위치 경로 가져 오기?
- 25. 현재 위치 (좌표)를 Android에서 확인 하시겠습니까?
- 26. iOS에서 GPS 장치를 사용하여 현재 위치 확인
- 27. Android 휴대 전화에서 GPS 현재 위치 확인
- 28. Google지도 - 여행 경로 따라 가기
- 29. Google지도 모바일 jquery API 위치 및 방향
- 30. Google지도 - 낮은 경로에 대한 포인트 순서 확인
사용자의 위치를 검색하는 데 문제가 있습니까? – Axarydax