¾ÛÅøÁî
46.¢½.168.138
46.¢½.168.129
46.¢½.168.161
46.¢½.168.136
46.¢½.168.145
46.¢½.168.162
46.¢½.168.144
46.¢½.168.140
115.¢½.135.198
46.¢½.168.139
 
°Ô½Ã¹° 12°Ç
   
À§Ä¡Á¤º¸ GPS °£´Ü ¼Ò½º
±Û¾´ÀÌ : Å«°õ                   ³¯Â¥ : 2010-10-26 (È­) 15:05 Á¶È¸ : 3940

package com.NoTrue;

import java.io.IOException;
import java.util.Iterator;
import java.util.Locale;

import android.app.Activity;
import android.content.Context;
import android.location.Address;
import android.location.Geocoder;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.widget.Toast;

import android.location.Criteria;

public class Main extends Activity implements LocationListener{

 // LocationManager ¹× º¯¼ö ¼±¾ð
     private LocationManager _Location = null;
     String _BestProvider = null;
     private double _Latitude = 0;
     private double _Longitude = 0;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

 // get.. ¹«¾ùÀÎÁö ¸ð¸£°ÚÁö¸¸ °¡Á®¿Â´Ù´Â°Å°ÚÁÒ? LOCATION_SERVIECE Áö¿ª¼­ºñ½º±º¿ä
       _Location = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
     
// Criteria ÀÚ¼¼ÇÑ°Ç ¸ð¸£°ÚÁö¸¸ Áö¿ªÁ¤º¸ °¡Á®¿Ã¶§ »ó¼¼È÷ °¡Á®¿Ã°ÍÀÎÁö,
// º£Å͸® »ç¿ë¿¡ °ü·ÃµÈ ³»¿ëÀÎµí ½Í³×¿ä. 
// requestLocationUpdates ÀÎÀÚ4°³, getBestProvider°ª, ½Ã°£, °Å¸®, this? 
// ½Ã°£, °Å¸® µî¿¡ µû¶ó GPS ¾÷µ¥ÀÌÆ® °ü·ÃÀΰŠ°°³×¿ä( 1000 -> 1 ¹Ù²Ù¸é ¹ÌÄ¡´Â? )  
      Criteria _Criteria = new Criteria();
      _Criteria.setAccuracy(Criteria.NO_REQUIREMENT);
      _Criteria.setPowerRequirement(Criteria.NO_REQUIREMENT);  
      _BestProvider = _Location.getBestProvider(_Criteria, true);
      _Location.requestLocationUpdates(_BestProvider, 1000, 0, this);
    }

 public void onLocationChanged(Location location) {

// onLocationChanged µüºÁµµ ¾Æ½Çµí.. Áö¿ªÀÌ ¹Ù²ð¶§¸¶´Ù Location °ª ¹Þ±â
      _Latitude = location.getLatitude();
      _Longitude = location.getLongitude(); 
 }
 @Override
 public void onProviderDisabled(String provider) { }
 @Override
 public void onProviderEnabled(String provider) { }
 @Override
 public void onStatusChanged(String provider, int status, Bundle extras) { }

 protected void onResume(){
     super.onResume();
 
// ÀûÈù À̸§¸¸ ºÁµµ ´ëÃæ ¾î¸²ÁüÀÛÀÌ ´Ù µÉ²¨ °°¾Æ¿ä ¤·¤· 
// ¹ºÁö ¸ð¸£Áö¸¸ locaitonÀÇ getLastKnownLocation. °¡Áö¿Ã²¨´Ù ¸¶Áö¸·ÀÇ ¾Ë°íÀÖ´Â Áö¿ªÁ¤º¸
// ^^; ÇÏÇÏÇÏ... Àü ´Ü¼øÇØ¿ä.
     Location loc = _Location.getLastKnownLocation(_BestProvider);

     if (loc != null){
      onLocationChanged(loc);
     }  
     _Location.requestLocationUpdates(_BestProvider, 0, 0, this);
 
     String _Result = "";
 
// Áö¿ª°ªÀ» ¾Ë·Á¸é Geocoder¸¦ »ç¿ëÇØ¾ß ÇÑ´Ù°í Çϴ±º¿ä. À§, ¾Æ·¡ µÑÁß Çϳª¸¦ ¾²¸éµÅ¿ä
//  Geocoder _Geocoder = new Geocoder(this);
     Geocoder _Geocoder = new Geocoder(getApplicationContext(), Locale.KOREA);
 
      Iterator<Address> _Addresses;
      try {
           _Addresses = _Geocoder.getFromLocation(_Latitude, _Longitude, 3).iterator();
           if (_Addresses != null){
               while(_Addresses.hasNext()){
                     Address namedLoc = _Addresses.next();
                     String featureName = namedLoc.getFeatureName();
                     _Result = String.format("%s", featureName);
// ¹Ø¿¡ ÆÁ³»¿ëÀ» ¿©±â Ãß°¡ÇÏ¸é µÅ¿ä.
                }
                // À§µµ, °æµµ Ãâ·ÂÇÔ
                Toast.makeText(this, _Latitude + "," + _Longitude, Toast.LENGTH_LONG).show();
           }
      } catch (IOException e) {
         e.printStackTrace();
      }
 }
}

ÆÁ1.    //ÀÌ·¸°Ô Çغ¸¸é ºÎ»ê½Ã ¾îµð±¸ ¾îµðµ¿ ¸î¹øÁö ¿ìÆí¹øÈ£ ´Ù ³ª¿Ã²¨¿¡¿ä ^^.
          String placeName = namedLoc.getLocality();                    
          String featureName = namedLoc.getFeatureName();                    
          String country = namedLoc.getCountryName();
                    //³ª¶ó¸¦ ¹ÞÀ½
          String road = namedLoc.getThoroughfare();
                    //µµ·Î¸¦ ¹ÞÀ½.
         _Result += String.format("\n[%s][%s][%s][%s]", placeName, featureName, road, country);

ÆÁ2. // À§µµ °æµµ °íµµ °ªÀ» ¾Ë¼ö°¡ ÀÖ¾î¿ä ^^
     _Latitude = location.getLatitude();
     _Longitude = location.getLongitude();
     _Altitude = location.getAltitude();

ÆÁ3. // ¿¡¹Ä·¹ÀÌÅÍ¿¡¼­ Å×½ºÆ®½Ã È­¸é ¿À¸¥ÂÊ »ó´ç DDMS Ŭ¸¯Çغ¸½Ã¸é ½Ã¹Ä·¹ÀÌÅÍ¿¡¼­
           ÀüÈ­°É±â, ¹®ÀÚº¸³»±â, GPS °ª Áֱ⠵î ÀÛ¾÷À» ÇÒ ¼ö ÀÖ½À´Ï´Ù ^^






 
Å«°õ 2010-10-26 (È­) 15:06
¤Ñ.¤Ñ;; Àû°í ³ª´Ï »ý°¢º¸´Ù ±æ¾îÁ³³×¿ä.. ÁÖ¼®»©¸é ªÀº ³»¿ëÀε¥...
°ñ°ÝÀÏ»ÓÀÔ´Ï´Ù. ´Ôµé²¬·Î ¸¸µé¾î¹ö¸®¼¼¿ä.. ÀÀ¿ëÇϼ¼¿ä~ ^^
 
ÀÌ°æ¿ë 2010-10-26 (È­) 15:22
ÁÖ¼®Àº ¼Ò½º ºÐ¼®¿¡ ¹Ýµå½Ã ÇÊ¿äÇÑ °ÍÀÌÁö¿ä.
ÁÖ¼®¶§¹®¿¡ ¼Ò½º°¡ ¾ûû³ª°Ô ±æ¾îÁ®µµ ¼Ò½º¸¦ ºÐ¼®ÇÏ´Â ÀÌ¿¡°Ô´Â Å« µµ¿òÀÌ µÇ´Â°ÍÀÌ´Ï ¾ó¸¶´øÁö ±æ°Ô ÀÛ¼ºÇϼ¼¿ä! ^^
 
ÇÑ»ó³² 2011-03-25 (±Ý) 19:53

¸ðµç ¼Ò½º°¡ ÀÌó·³ ÁÖ¼®ÀÌ ´Þ·ÈÀ¸¸é...ÇÏ´Â....
¾ÆÁ÷Àº ºÁµµ Àß ¸ð¸£Áö¸¸....
±×³ª¸¶ ÀÌÇØÇϱⰡ ÆíÇϳ׿©...°¨»çÇÕ´Ï´Ù..

 
ÀÌÁ¦ÀÏ 2012-02-23 (¸ñ) 20:49
ÀÌ·¸°Ôº¸´Ï Á¶±ÝÀº ÀÌÇضö±î ¤Ð¤Ð...
ÁÖ¼®Àº ±æ¾îµµ ÁÁ¾Æ¿ä!!
 
¹ÚÁØö 2012-12-10 (¿ù) 19:00
ÁÁÀº Á¤º¸ °¨»çÇÕ´Ï´Ù..^^
   

°Ô½Ã¹° 12°Ç
¹øÈ£ Á¦¸ñ ±Û¾´ÀÌ ³¯Â¥ Á¶È¸
12  1ÀÎ ¾Ûâ¾÷ ½ºÅ¸Æ®¾÷ ¼ÒÈ£±â¾÷ ÇÊ»ì±â¸¦ º¸¿©ÁÖ¸¶ ¹Î¼¼¿¬ 12-25 3603
11  ¾Èµå·ÎÀ̵å 4 3 Á©¸®ºó On °¶·°½Ã ³Ø¼­½º ±â´É ¹× Èı⠹ÚÃÊ·Õ 12-25 3562
10  ¾Èµå·ÎÀÌµå °³¹ß °­Á ´ÙÀ̾ó·Î±× 4 Custom Dialog ¹èµåº¸ 12-25 3912
9  ¡¡¡¡¡¡ ¼­»óÀº 12-24 2636
8  ¾×Á¤¿¡ ¼Õ°¡¶ôÀ» ´©¸£´Â ½Ã°£¿¡ µû¸¥ ÇÔ¼ö È£Ãâ +5 ±è±â¹ü 11-15 3281
7  - Camera)Ä«¸Þ¶ó ¿ÀǸ¸ ÇÏ´Â ¼Ò½º +1 ±è±â¹ü 11-03 3928
6  [¸µÅ©]ÇÁ·Î±×·¹½º ´ÙÀ̾ó·Î±×(ProgressDialog)»ý¼ºÇϱâ Å«°õ 10-27 3064
5  [¸µÅ©]¾Èµå·ÎÀ̵å(android) ´ÙÀ̾ó·Î±× Á¾·ùº° ±¸Çö ¹æ¹ý Å«°õ 10-27 3640
4  À§Ä¡Á¤º¸ GPS °£´Ü ¼Ò½º +5 Å«°õ 10-26 3941
3  ¾Ë¾ÆµÎ¸é À¯¿ëÇÑ permission +2 Å«°õ 10-26 3074
2  ¾Ë¾ÆµÎ¸é ÁÁÀº ±â´É ÄÚµå ¸ðÀ½ +3 Å«°õ 10-26 3291
1  Activity À̵¿½Ã ƯÁ¤°ª ³Ñ°ÜÁÖ±â +4 Å«°õ 10-15 3231
 
 
 
Copyright ¨Ï wwwold.androidstudy.co.kr. All rights reserved.