I cannot run application on android, but emulator can.
- by Daisy
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();
}
from code above, when I run on android phone. It can run but its only show location is null.
I don't know why its can't get location from getLastKnownLocation()
http://www.javacodegeeks.com/2010/09/android-location-based-services.html
This is a source code which I got to tried. Please help me. Thanks ka :))
Ps. I already have I already have ACCESS_FINE_LOCATION,ACCESS_MOCK_LOCATION, and ACCESS_COARSE_LOCATION