Richard,
Joining this discussion late.
I hit a similar problem when developing on a Mac using Eclipse and a
level 8 (SDK 2.2 plus Google APIs) target.
I was using code like this, based on an example in Reto Meier's book
Professional Android 2 Application Development
-----------------------
Geocoder geoCoder = new Geocoder(this, Locale.getDefault());
try {
List<Address> addresses =
geoCoder.getFromLocation(latitude,
longitude, 1); // maxResults
StringBuilder sBuilder = new StringBuilder();
if(addresses.size() > 0){
Address address = addresses.get(0);
for(int i=0; i <
address.getMaxAddressLineIndex(); i++){
sBuilder.append(address.getAddressLine(i)).append("\n");
sBuilder.append(address.getLocality()).append("\n");
sBuilder.append(address.getPostalCode()).append("\n");
sBuilder.append(address.getCountryName()).append("\n");
}
addressString = sBuilder.toString();
}
} catch(IOException e) {
addressString = "Sorry address could not be
established\n" +
e.toString();
}
-----------------------------
The addressString value is displayed to the user via a TextView
object.
When running it on the emulator I alweays got a java.io.IOException:
Service not Available
Switching to an earlier level 7 target 8 (SDK 2.1 plus Google APIs)
and redeploying the same code, the first time I ran it I got a more
hopeful error "no address found" or similar, then after sending a
location via the emulator, I got the full geocoded address correctly
displayed. I am thus in the situation like Kugelschlag - that
geocoding on an emulator works in 2.1 (7) but throws an Io Exception
in 2.2 (8).
HTH
Malcolm :-)
On Jun 8, 8:35 am, Richard <[email protected]> wrote:
> Thanks for a response ! As nobody else has anything to say I'm
> stumped ;-)
>
> Is it possible Google is blocking location services based on my ip's
> geographic location (e.g. Australia) when using theemulator?
>
> To repeat myself, I've tested it on AVDs:2.1&2.2using both API
> level 7 & 8.
>
> 2.1Level 7 Emulation
> only lists GPS support
> 06-08 17:30:38.330: DEBUG/LocationManager(197): getAllProviders
> 06-08 17:30:38.330: VERBOSE/TripStart(197): Listing supported
> providers
> 06-08 17:30:38.341: VERBOSE/TripStart(197): ....gps supported
> 06-08 17:30:38.351: ERROR/LocationManagerService(64):
> isProviderEnabled got exception:
> 06-08 17:30:38.351: ERROR/LocationManagerService(64):
> java.lang.IllegalArgumentException: provider=network
> 06-08 17:30:38.351: ERROR/LocationManagerService(64): at
> com.android.server.LocationManagerService._isProviderEnabledLocked(LocationManagerService.java:
> 1385)
> 06-08 17:30:38.351: ERROR/LocationManagerService(64): at
> com.android.server.LocationManagerService.isProviderEnabled(LocationManagerService.java:
> 1359)
> 06-08 17:30:38.351: ERROR/LocationManagerService(64): at
> android.location.ILocationManager
> $Stub.onTransact(ILocationManager.java:237)
> 06-08 17:30:38.351: ERROR/LocationManagerService(64): at
> android.os.Binder.execTransact(Binder.java:287)
> 06-08 17:30:38.351: ERROR/LocationManagerService(64): at
> dalvik.system.NativeStart.run(Native Method)
>
> 2.2Level 8 Emulation
> 05-31 01:49:14.990: VERBOSE/TripStart(311): Listing supported
> providers
> 05-31 01:49:14.990: VERBOSE/TripStart(311): ....network supported
> 05-31 01:49:14.990: VERBOSE/TripStart(311): ....passive supported
> 05-31 01:49:14.990: VERBOSE/TripStart(311): ....gps supported
> 05-31 01:50:14.421: VERBOSE/TripStart(311): java.io.IOException:
> ServicenotAvailable
>
> The app works on an HTC Desire but its a pain to develop & debug
> without the aboveemulatorfunctionality.
>
> Richard
>
> On Jun 5, 10:24 am, Kugelschlag <[email protected]> wrote:
>
> > I have seen the same issue when I updated from2.1and API Level 7
> > (where it works) to2.2API Level 8 (where it doesnot).
>
> > Seems to be in the level 8 package. I also noticed quite a bit of
> > slowdown in the map view scrolling after updating to2.2.
>
> > Anybody else see this?
>
> > Tested on Windows 7 using Eclipse.
>
> > Kugelschlag
>
> > On May 30, 7:50 pm, Richard <[email protected]> wrote:
>
> > > I have been unable to getreversegeocodingwokring under either2.1
> > > or2.2on the emulators. Tested on both mac/eclipse & ubuntu/eclipse.
>
> > > I am sending manual decimal coordinates via DDMS and have
> > > ACCESS_FINE_LOCATION & INTERNET permissions in my manifest file.
>
> > > On an actual phone (HTC Desire) it functions properly.
>
> > > On2.2api level 8 Emulation
> > > 05-31 01:49:14.990: VERBOSE/TripStart(311): Listing supported
> > > providers
> > > 05-31 01:49:14.990: VERBOSE/TripStart(311): ....network supported
> > > 05-31 01:49:14.990: VERBOSE/TripStart(311): ....passive supported
> > > 05-31 01:49:14.990: VERBOSE/TripStart(311): ....gps supported
>
> > > The following code throws the exception below
>
> > > Location l = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
> > > List<Address> list = geocoder.getFromLocation(l.getLatitude(),
> > > l.getLongitude(), 1);
>
> > > 05-31 01:50:14.421: VERBOSE/TripStart(311): getting last know location
> > > Lat: -34:33:16.2 Lon: 151:34:30
> > > 05-31 01:50:14.421: VERBOSE/TripStart(311): java.io.IOException:
> > > ServicenotAvailable
>
> > > On2.1api level 7 Emulation
> > > 05-31 02:30:57.713: DEBUG/LocationManager(286): getAllProviders
> > > 05-31 02:30:57.713: VERBOSE/TripStart(286): Listing supported
> > > providers
> > > 05-31 02:30:57.723: VERBOSE/TripStart(286): ....gps supported
>
> > > as one one cant use the NETWORK_PROVIDER, it results in a
> > > 05-31 02:30:57.753: ERROR/LocationManagerService(64):
> > > isProviderEnabled got exception:
> > > 05-31 02:30:57.753: ERROR/LocationManagerService(64):
> > > java.lang.IllegalArgumentException: provider=network
>
> > > I have been looking for docs on this and can find very little
> > > information on the above to confirm whether it should or shouldnot
> > > work.
>
> > > I would be very grateful if someone could respond with some guidance
> > > on this issue.
>
> > > thanks.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en