Example #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // 지도 객체 생성과 API_KEY 설정
    mapview = new NMapView(this);
    mapview.setApiKey(API_KEY);

    // 지도를 보여주기 위한 부분을 찾고 지도 상에 Zoom 버튼을 생성한다.
    mapview = (NMapView) findViewById(R.id.mapview);
    mapview.setBuiltInZoomControls(true, null);

    // GPS 장치를 이용하기 위해 LocationManager를 사용한다.
    // requestLocationUpdates의 파라메타 값으로 GPS or Network 장치를 설정하고 위치 갱신 시간과 갱신 받기위한 거리, Listener를
    // 설정한다.
    LocationManager manager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    manager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 10000, 0, (LocationListener) this);
  }