【发布时间】:2010-12-27 14:26:24
【问题描述】:
protected void showCurrentLocation(){
Location lc = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
if(lc != null){
String msg = String.format("Current Location \n Logitude: %1$s \n Latitude: %2$s",lc.getLongitude(),lc.getLatitude());
Toast.makeText(Test1.this,msg,3000).show();
}
Toast.makeText(Test1.this,"location is null",3000).show();
}
从上面的代码中,当我在 Android 手机上运行时,它可以运行,但它只显示位置为空。 我不知道为什么它无法从 getLastKnownLocation() 获取位置
http://www.javacodegeeks.com/2010/09/android-location-based-services.html
这是我必须尝试的源代码。请帮我。谢谢卡:))
附言。我已经有了 ACCESS_FINE_LOCATION、ACCESS_MOCK_LOCATION 和 ACCESS_COARSE_LOCATION
【问题讨论】:
标签: android android-emulator gps