OK, I managed to narrow down the problem. It happens when I invoke the 
Geocoder over my Wifi connection, but works fine over 3G. My Wifi connection 
is connected normally, if I open the browser I can open any web page.

This is my manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android";
package="com.mypackage" android:versionCode="5" android:versionName="1.2.1">
<uses-sdk android:minSdkVersion="4" />
<application android:icon="@drawable/ic_launcher_myapp"
android:label="@string/app_name" android:debuggable="true">
<activity android:name=".MyActivity" 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>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>


The part of the code where I call the geocoder:

birthPlaceFilterText.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(final Editable arg0) {
// hide all birth-related views except textfield
hideAllBirthPlaceRows();
if (pendingTimerTask != null) {
// cancel any pending tasks
pendingTimerTask.cancel();
}
birthPlaceSpinner.setAdapter(null);
// don't create a background task for empty place filter
if(arg0 == null || "".equals(arg0)) {
return;
} else {
pendingTimerTask = new TimerTask() {
private boolean canceled = false;
@Override
public boolean cancel() {
this.canceled = true;
return super.cancel();
}
@Override
public void run() {
if (isOnline()) {
try {
birthplaceChangedHandler.sendEmptyMessage(SHOW_PROGRESS_BAR_ROW);
validNewAddresses = new ArrayList<Address>();
List<Address> newAddresses = gc.getFromLocationName(arg0.toString(),10);
if(!canceled) {
for (Address address : newAddresses) {
if (address.getCountryCode() != null) {
validNewAddresses.add(address);
}
}
validNewAddressesStr = convertAddressesToStrings(validNewAddresses);
birthplaceChangedHandler.sendEmptyMessage(NO_MESSAGE);
}
} catch (IOException e) {
// e.printStackTrace();
throw new RuntimeException(e);
//     if(!canceled) {
//     
birthplaceChangedHandler.sendEmptyMessage(SHOW_NO_INTERNET_CONNECTIVITY_WARNING);
//     }
}
} else if(!canceled) {
birthplaceChangedHandler.sendEmptyMessage(
SHOW_NO_INTERNET_CONNECTIVITY_WARNING);
}
}
};
timer.schedule(pendingTimerTask, 1000);
}
}
public void beforeTextChanged(CharSequence arg0, int arg1,
int arg2, int arg3) {
// Do nothing
}
public void onTextChanged(CharSequence arg0, int arg1, int arg2,
int arg3) {
// Do nothing
}
}); 


 The above code works fine over 3G, but throws an IOException when used over 
Wifi. I get:

Caused by java.io.IOException: RPC failed with status 1
at android.location.Geocoder.getFromLocationName(Geocoder.java:178)
at com.mypackage.MyActivity$3$1.run(MyActivity.java:200)
... 1 more

Any ideas what might be causing it? 

                                

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to