I am using the Geocoder.getLocationFromName() method on both the emulator and my phone (Nexus S with Android 4.1) and I get the following exception:
java.io.IOException: Service not Available
There are a number of questions about this appearing on the emulator (example), and most of them say that it is a specific version of the emulator that has the problem. However, the exception appears both on my AVDs (2.3 and 4.1) and my phone.
Both my phone and the AVDs have internet connection. My API version is 16 (android 4.1), but I also tried with older ones. Both AVDs include Google APIs.
Any ideas what is going on here?
This is the relevant code snippet:
Geocoder myGeocoder = new Geocoder(getApplicationContext(), Locale.getDefault());
List<Address> newAddresses = myGeocoder.getFromLocationName(arg0.toString(), 10);
And this is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.asdasd" android:versionCode="6" android:versionName="1.3.1">
<uses-sdk android:minSdkVersion="16" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application android:icon="@drawable/ic_launcher_asdasd"
android:label="@string/app_name">
<activity android:name=".AsdasdActivity" android:label="@string/app_name"
android:screenOrientation="portrait" android:windowSoftInputMode="stateHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation" />
</application>
</manifest>