locManger = (LocationManager)getSystemService(Context.LOCATION_SERVICE);


criteria = new Criteria();

criteria.setAccuracy(Criteria.ACCURACY_COARSE);

criteria.setPowerRequirement(Criteria.POWER_LOW); 

criteria.setAltitudeRequired(false); 

criteria.setBearingRequired(false); 

criteria.setSpeedRequired(false); 

criteria.setCostAllowed(true);


String provider = locManger.getBestProvider(criteria, true);

loc = locManger.getLastKnownLocation(provider);


gpsLatitude = (int) (loc.getLatitude() * 1E6);

gpsLongitude = (int) (loc.getLongitude() * 1E6);


이렇게 했을때는 4.0 에서 널포인트익셉션 애러가 나고 2.3에서는 정상적으로 구동이 됩니다.

혹시나 4.0 에서는 다른 방식이 있나 해서 


locManger = (LocationManager)getSystemService(Context.LOCATION_SERVICE);

loc = locManger.getLastKnownLocation(LocationManager.GPS_PROVIDER);


gpsLatitude = (int) (loc.getLatitude() * 1E6);

gpsLongitude = (int) (loc.getLongitude() * 1E6);


이렇게도 해 봤는데 똑같이 애러가 나고 있습니다.


4.0 버전에서 특별하게 해 줘야 할게 있나요??