• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Permission Exception when reading remote files

hshhbd

Lurker
I was trying to read a xml file remotely but keep getting the java.net.SocketException: Permission denied exception. I tried the same thing within a normal java application and it works.

Here is the code:
try
{
URL url = new URL("http://rss.weather.com/rss/national/rss_nwf_rss.xml?cm_ven=NWF&cm_cat=rss&par=NWF_rss");
InputStream input = url.openStream();
}
catch(Exception e)
{
e.printStackTrace();
}

I was doing it in a Android Emulator, maybe that's the cause?

Thanks very much in advance for any replies.
 
Did you enable the GSM Modem when creating the AVD?

Thanks for your reply. Actually I have just solved the problem. It's something to do with the manifest file. To solve the problem, the following line will need to be added.
<uses-permission android:name="android.permission.INTERNET"/>

This enables your android application talking to files on remote servers.
 
Back
Top Bottom