पर IOException फेंकता एंड्रॉयड एमुलेटर 2.2 एपीआई 8 का उपयोग करते हुए मैं IOExceptionGeocoder.getFromLocation एंड्रॉयड एमुलेटर
03-05 19:42:11.073: DEBUG/SntpClient(58): request time failed: java.net.SocketException: Address family not supported by protocol
03-05 19:42:15.505: WARN/System.err(1823): java.io.IOException: Service not Available
हो रही मेरी कोड Thats रखें:
private LocationManager manager = null;
LocationListener locationListener = null;
double latitude = 0;
double longtitude = 0;
List<Address> myList = null;
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// httpTranslateGet();
try
{
manager = (LocationManager) this
.getSystemService(Context.LOCATION_SERVICE);
initLocationListener();
manager.requestLocationUpdates(manager.GPS_PROVIDER, 0, 0,
locationListener);
}
catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private void initLocationListener()
{
locationListener = new LocationListener()
{
@Override
public void onLocationChanged(android.location.Location location)
{
if (location != null)
{
latitude = location.getLatitude();
longtitude = location.getLongitude();
try
{
Geocoder geocoder = new Geocoder(WeatherCastDemo.this, Locale.getDefault());
List<Address> addresses = geocoder.getFromLocation(location.getLatitude(), location.getLongitude(), 1);
myList = geocoder.getFromLocation(
location.getLatitude(),
location.getLongitude(), 10);
StringBuilder sb = new StringBuilder();
if (myList.size() > 0)
{
Address address = myList.get(0);
for (int i = 0; i < address
.getMaxAddressLineIndex(); i++)
sb.append(address.getAddressLine(i)).append(
"\n");
sb.append(address.getLocality()).append("\n");
sb.append(address.getPostalCode()).append("\n");
sb.append(address.getCountryName());
}
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
@Override
public void onProviderDisabled(String arg0)
{
// TODO Auto-generated method stub
}
@Override
public void onProviderEnabled(String provider)
{
// TODO Auto-generated method stub
}
@Override
public void onStatusChanged(String provider, int status,
Bundle extras)
{
}
};
}
किसी को भी किसी भी विचार है?
मैंने इसे एमुलेटर 2.1 एपीआई 7 के साथ करने में कामयाब रहा है, लेकिन फिर रिवर्स जियोकोडिंग हमेशा खाली परिणाम देती है। कोई भी मेरे कोड की पुष्टि कर सकता है?
धन्यवाद।
धन्यवाद, किरण।
क्या आप फ़ायरवॉल या प्रॉक्सी के अंतर्गत हैं? –
क्या आप अपने एम्यूलेटर के साथ इंटरनेट से जुड़े हुए हैं? ब्राउज़र का उपयोग करके इसे जांचें। –
मैं फ़ायरवॉल/प्रॉक्सी के तहत नहीं हूं और हां, मैं इंटरनेट से कनेक्ट हूं। – rayman