나의 첫 서울시 공공앱을 이제 마켓으로 올릴 수 있을 정도로

완성된 듯 하다.

 

 

1. 사용에 관련된 주요기능

1) GPS가 켜있는 상태에서는 현재 위치 기준으로 가까운 주차장부터 찾아서 정렬

2) 서울시 공영주차장 19개의 주차장의 현재 잔여주차대수를 일괄으로 볼 수 있음

3) 주차장을 클릭하면 위치를 지도로 위치 확인 가능

4) 자세한 내용은 전화번호로 전화하여 문의 가능

2. 아쉬운 점

1) 좀더 많은 데이타(주차요금 등..)이 없음이 좀 아쉽다.

2) 보다 많은 주차장의 정보를 볼 수 있으면 좋으련만 19개의 주차장만 데이타를 제공한다.

3. 사용된 기술적 요소

1) html  request

- 서울시 공공API사용시 와 다음 로컬 API사용시 사용

- 아래는 서울시 공공API사용시 예제

 			  try{
				  URL url = new URL(urls[0]);
				  HttpURLConnection conn = (HttpURLConnection)url.openConnection();
				  if(conn != null){
					  conn.setConnectTimeout(10000);
					  conn.setUseCaches(false);
			        
					  if(conn.getResponseCode() == HttpURLConnection.HTTP_OK){
						  BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));      
						  for(;;){
							  String line = br.readLine();
							  if(line == null) break;
							  html.append(line+"\n");     
						  }     
						  br.close();
					  }
					  else{
			     
					  }
					  conn.disconnect();
				  }   
			  }
			  catch(Exception ex)
			  {
				  Log.e(TAG,"DownloadHtml ex=["+ex+"]"); 
				  return null;
			  } 

2) AsynTask기능

- 안드로이드 3.0(허니콤)부터는 network을 사용시에는 asyntask를 사용하여 처리가 늦어질 때를 대비하여 화면반응속도를 따로 처리하게 하여 사용자에게 앱이 죽은 듯 보여짐을 방지하고자 한다.

3) xml parser

- 서울공공API와 다음로컬 API시 xml로 받아서 분석하는 로직

		//API 요청 및 반환
		URLConnection conn = url.openConnection();
		DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
		DocumentBuilder builder = factory.newDocumentBuilder();
		Document doc = builder.parse(conn.getInputStream());
		
		//channel노드를 객체화 하기
		Node node = doc.getElementsByTagName("channel").item(0);
		for (int i=0 ;i< node.getChildNodes().getLength();i++) {
			Node channelNode = node.getChildNodes().item(i);
			String nodeName = channelNode.getNodeName();
			
			//item 노드들일 경우
			if ("item".equals(nodeName)) 
			{
				//item노드의 자식노드를 검색
				for (int j=0 ;j< channelNode.getChildNodes().getLength();j++) 
				{
					Node itemNode = channelNode.getChildNodes().item(j);
					//title노드 일 경우 출력
					if("lng".equals(itemNode.getNodeName())){
						xy[0]= itemNode.getTextContent();
						
					}else if("lat".equals(itemNode.getNodeName())){
						xy[1]= itemNode.getTextContent();
						
					}	
				}
			}

4) SQLite

- 각 주차장의 데이타를 DB에 저장하는 데 사용함

5) tableview

- scrolling하는 기능의 추가와 헤더와 contents부분의 column사이즈를 맞추는 문제와 click event부여하는 문제 어느 것 하나 쉽지만은 않았음

6) 서울시 공공API 사용

- 서울시는 여러 공공의 데이타(http://data.seoul.go.kr/)를 시민들이 사용하기 편리하도록 공개하고 있음 이 앱은 이 데이타를 기반으로 만들어진 앱임

 7) 다음 API사용

- 다음의 로컬 API와 지도 API사용

		mapView = new MapView(this);
		
		mapView.setDaumMapApiKey("bcc6844e5b1aea2eda0dd7b52860dc30e3b97950");
		mapView.setOpenAPIKeyAuthenticationResultListener(this);
		mapView.setMapViewEventListener(this);
		mapView.setCurrentLocationEventListener(this);
		mapView.setPOIItemEventListener(this);

		mapView.setMapType(MapView.MapType.Standard);
		Log.d(TAG,"[1]dlng:["+ dlng + "],["+dlat +"]");
		// Move and Zoom to
		
		mapView.setMapCenterPointAndZoomLevel(MapPoint.mapPointWithGeoCoord(dlat, dlng),1, true);
		
		MapPOIItem poiItem1 = new MapPOIItem();
		poiItem1.setItemName(sname);
		
		poiItem1.setMapPoint(MapPoint.mapPointWithGeoCoord(dlat, dlng));
		poiItem1.setMarkerType(MapPOIItem.MarkerType.BluePin);
		poiItem1.setShowAnimationType(MapPOIItem.ShowAnimationType.NoAnimation);
		poiItem1.setShowCalloutBalloonOnTouch(true);
		poiItem1.setTag(153);	
		mapView.addPOIItem(poiItem1);
		mapView.fitMapViewAreaToShowAllPOIItems();
		linearLayout.addView(mapView);	

8) Action Bar에  refresh 메뉴 추가

9) intent

- 상세조회시 페이지를 다른 class로 하여 intent를 사용하여 call했으며 전화를 calling시에도 사용

10) 현위치 도출

- GPS를 이용하여 최근저장 위치를 처음에는 불러주고

나중에 이동시마다 10분간격으로 현위치를 저장하고 이에 따른 거리를 계산하도록 함

 

SeoulParking_20130320 (2).zip

+ Recent posts