I cannot run application on android, but emulator can.

Posted by Daisy on Stack Overflow See other posts from Stack Overflow or by Daisy
Published on 2010-12-27T14:26:24Z Indexed on 2010/12/27 14:54 UTC
Read the original article Hit count: 282

Filed under:
|
|
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

© Stack Overflow or respective owner

Related posts about android

Related posts about android-emulator