我是Android新手,我試圖在我的應用程序中檢索GPS數據。 我使用下面的代碼 LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
locationmanager.requestForLocation不適用於摩托羅拉backflip&samsung galaxy
if (!lm.isProviderEnabled(LocationManager.GPS_PROVIDER)){
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000L, 500.0f, this);
}
而且我的課我已經重寫了以下方法
public void onLocationChanged(Location location)
{
String currentLocation = "The location is changed to Lat: " + location.getLatitude()+ " Lng: " + location.getLongitude();
Toast.makeText(context, currentLocation, Toast.LENGTH_LONG);
}
但它沒有顯示任何東西,這是與摩托羅拉只發生後空翻&三星Galaxy設備。 請讓我知道如果我做錯了什麼。提前致謝。
Thansk, Devanand