I wrote a simple activity to check for the presence of Geocoder, calling Geocoder.isPresent () always returns false.
Grade:
public class LocationTestActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); Log.d( "LocationTestActivity", "Geocoder.isPresent : " + Geocoder.isPresent() ); } }
AndroidManifest.xml ALSO has the following entries before the "application" element:
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="14"/> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
Environment: Eclipse Indigo 3.7.1, ICS 4.0 emulator on XP Professional 2002 SP 3
Please help me understand:
1. Why does Geocoder.isPresent () always keep false?
2. What changes make Geocoder.isPresent () return true?
Many thanks!
source share