location.getLatitude和经度无法在某些Android设备上运行

时间:2014-04-13 03:41:47

标签: android gps

我正在使用Android GPS应用程序,我发现,在某些设备上,例如micromax,碳,我无法通过位置管理器或使用它的API来获得经度,经度<\ n <。< / p>

LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);

LocationListener locationListener = new LocationListener() 
{
    public void onLocationChanged(Location location) 
    {

        double latitude = location.getLatitude();
        double longitude = location.getLongitude();

    }
    public void onStatusChanged(String provider, int status, Bundle extras) {}
    public void onProviderEnabled(String provider) {}
    public void onProviderDisabled(String provider) {}
};

locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener);

0 个答案:

没有答案