views:

286

answers:

3

Hi I have recently noticed that when Running the function geoCoder.getFromLocationName() on android 2.2 (Froyo) then i Receive a IOExeption (Which does not occur on other SDK versions).

After some reserch i have found suggentions to add the following Permisions:

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

However this does not solve the problem, and this appears to be a Android SDK Bug. Is there a knows solution to this problem?

EDIT: Here is the stack trace though it is not particularly helpful the inner stack trace is null so not great.

08-26 18:37:53.831: WARN/System.err(347): at android.location.Geocoder.getFromLocationName(Geocoder.java:159) 08-26 18:37:53.831: WARN/System.err(347): at com.Finko.HomeScreen.onCreate(HomeScreen.java:32) 08-26 18:37:53.851: WARN/System.err(347): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 08-26 18:37:53.851: WARN/System.err(347): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627) 08-26 18:37:53.851: WARN/System.err(347): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 08-26 18:37:53.861: WARN/System.err(347): at android.app.ActivityThread.access$2300(ActivityThread.java:125) 08-26 18:37:53.861: WARN/System.err(347): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) 08-26 18:37:53.871: WARN/System.err(347): at android.os.Handler.dispatchMessage(Handler.java:99) 08-26 18:37:53.882: WARN/System.err(347): at android.os.Looper.loop(Looper.java:123) 08-26 18:37:53.882: WARN/System.err(347): at android.app.ActivityThread.main(ActivityThread.java:4627) 08-26 18:37:53.891: WARN/System.err(347): at java.lang.reflect.Method.invokeNative(Native Method) 08-26 18:37:53.903: WARN/System.err(347): at java.lang.reflect.Method.invoke(Method.java:521) 08-26 18:37:53.903: WARN/System.err(347): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 08-26 18:37:53.911: WARN/System.err(347): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 08-26 18:37:53.911: WARN/System.err(347): at dalvik.system.NativeStart.main(Native Method)

A: 

look here already dicussion going i hv posted code there

http://stackoverflow.com/questions/3574644/how-can-i-find-latitude-and-longitude-using-address/3574792#3574792

ud_an
Yes, I saw that, That guy has the same problem as me in Froyo, The code posted as the solution works. However not in Froyo.
Jason
+1  A: 

now then,

It seems to me that this is a problem with the emulator... The getFromLocationName method seems to work just fine on the devices (at least I'm not getting reports of it not working from any users)

Whilst this is a total pain whilst developing and debugging on this version of Android, it seems you can use it.

I ended up adding a couple of text boxes that I'd just stick long and lat into whilst debugging, then removing before final build.

Not the best answer, but it might get you moving man. Good luck with it

Paul
Thanks, I am getting my android phone soon will test this out
Jason
A: 

Hi, I flagged this up in the anddev.org forum ages ago. A few folks have the same problem but none of us have a solution. I've since found that it's listed as a bug in http://code.google.com/p/android/issues/detail?id=8816. The IOException is 'service not available' if you use the AVD level 8. You get a hint that it's not going to work when, if you use Eclipse and you start up the emulator, the splash screen briefly displays a 'No Service' message as the android core is loading. I guess that it must be trying to register the services used in the apps at this point. I don't think there's any way to hook the debugger in at this point as it's probably all Dalvik bytecode running.

NickT