Google지도에서 관심 장소 (융합 표에 저장 됨)를 표시하는 방법에 대한 예를 찾고 있습니다. 퓨전 테이블 v2 Google지도의 POI : Android 예?
는 HTML에서이 작업을 수행하고 그것은 아주 사소한 자바 스크립트, 확인하려면 내 javascript map with fusion tables example참조 Fusion Tables page containing my POIs
내 목표/질문은 안드로이드 응용 프로그램에서 동일한을 달성하는 방법을 (를 코딩에 도움이 필요)입니다. 나는 안드로이드 개발에 익숙하지 않았고 이미 기본 및 문서 및 예제를 확인하는 데 많은 시간을 투자했습니다.
매우 좋음을 확인하십시오. Google Maps example for Android 시작했습니다. 테스트 앱은이 코드를 기반으로합니다.
지금까지 내가지도 내 마지막으로 알려진 위치를 중심으로 표시하고 그 위에 마커를 보여 달성 (V1에 대한 예제 가장 오래된)
Google API Java client samples on github (포인트 API 클라이언트를 Google에) . firepol/android-google-maps-fusion-tables on github
지금은 퓨전 테이블에서 오는 마커를 표시하고 싶습니다 : 나는 이것에 대한 좋은 예를 찾을 수 없습니다 때문에
, 내가보고, 게시하고 내 연구 결과를 공유하기로 결정했다. Google api 클라이언트를 통해 수행하려고하는 요청을 실행하는 데 막혔습니다. 여기Google API client example for Android
ActivityFeed feed = listActivities.execute();
내 (전에서 onCreate 안에 넣어 한) 코드 :
protected void prepareFusion() {
// Normally READONLY should be enough (see credential with one scope), but I checked online a console
// and I could see a public table only if I would grant both permissions
List<String> scopes = new ArrayList<>(Arrays.asList(FusiontablesScopes.FUSIONTABLES, FusiontablesScopes.FUSIONTABLES_READONLY));
credential = GoogleAccountCredential.usingOAuth2(this, scopes);
//credential = GoogleAccountCredential.usingOAuth2(this, Collections.singleton(FusiontablesScopes.FUSIONTABLES_READONLY));
// TODO : get account name automatically
// http://stackoverflow.com/questions/35789071/getting-the-gmail-id-of-the-user-in-android-6-0-marshmallow
credential.setSelectedAccountName("YOUR_GOOGLE_ACCOUNT");
client = new Fusiontables.Builder(
transport, jsonFactory, credential).setApplicationName("TestMap/1.0")
.build();
try {
String tableId = "1774o_WcrqSQlepLXlz1kgH_01NpCJ-6OyId9Pm1J";
Fusiontables.Query.Sql sql = client.query().sql("SELECT FileName,Name,Location FROM " + tableId);
//sql.execute();
//java.lang.IllegalStateException: Calling this from your main thread can lead to deadlock
Fusiontables.Table.Get table = client.table().get(tableId);
table.setFields("items(FileName,Name,Location)");
//table.execute();
// TODO : can't execute like this on main thread as the documentation example "suggests"
//https://developers.google.com/api-client-library/java/google-api-java-client/android
} catch (IOException e) {
e.printStackTrace();
}
}
내가 sql.execute를 동일한 작업을 수행하고 호출하려고하면() 또는 table.execute() 내가 얻을 : java.lang.IllegalStateException
: 메인 스레드 에서이를 호출하면 deadloc으로 이어질 수 있습니다 K
그래서 내가 좀 여기에 붙어있어 당신이지도의 결과를 얻기 위해 나를 도울 수 있다면 더 나은 구글 API 클라이언트와 경험을 가지고 누군가에서 진행하는 방법을 알고 싶습니다! 고맙습니다.
융합 표 POI를지도에 표시하는 방법은 무엇입니까? 내가 붙어있어 및 장치에 자신의 구글 맵 API 키 및 디버그를 추가, 안드로이드 스튜디오에서여, 나를 도와 내 github에의 REPO firepol/android-google-maps-fusion-tables on github를 복제 곳
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
// Add a marker to Zurich Oerlikon and move the camera
mMap.addMarker(new MarkerOptions().position(mDefaultLatLng).title("Zurich Oerlikon"));
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(
mDefaultLatLng, 13));
// TODO: add fusion tables POIs
}
을 참조하십시오. 귀하의 건설적인 의견, 답변 및 도움에 감사드립니다. 기분 전환을 자유롭게 할 수 있습니다.
Thx. 업데이트 된 자습서 또는 코드 샘플을 사용하여 Google API 클라이언트에서 비동기 작업을 사용할 수 있습니까? Robospice 등을 실제로 비교할 수있는 좋은 인트로를 찾을 수도 있습니다. https://www.reddit.com/r/androiddev/comments/3d1iim/retrofit_volley_or_robospice_and_jackson_or_gson / – firepol