views:

6781

answers:

4

I am trying to access http link using HttpURLConnection to download a file, but getting this warning in LogCat

WARN/System.err(223): java.net.SocketException: Permission denied (maybe missing INTERNET permission)

I have added android.Manifest.permission to my application but its still giving the same exception

Any suggestions?

+10  A: 

Assuming, you do not have permissions set from your LogCat error description, here is my contents for my AndroidMainfest.xml file that has access to the internet:

<manifest xlmns:android...>
 ...
 <uses-permission android:name="android.permission.INTERNET"></uses-permission>
</manifest>

Other than that, you should be fine to download a file from the internet.

Anthony Forloney
Thanks for quick help
rob
If you find answers that solve your question or seem helpful, its useful to select as "answered" and/or upvote, it helps out the community for anyone encountering the same problems. Thats not just directed to this question, but other questions you have asked also
Anthony Forloney
i didn't knew about it, i will do that for sure if this will solve my problem
rob
report back if you encounter anything different and I will be more than happy to assist.
Anthony Forloney
@Anthony Forloney, the exception I am getting is similar but not quite as the one in the posted question (SocketException with code 1124). If you can please try to help me, I appreciate it. Here's the link to the question I have just posted: http://stackoverflow.com/questions/3791930/android-application-socketexception-permission-denied-no-such-file-or-directory Thanks!
Fabio Milheiro
+2  A: 

If you are using the Eclipse ADT plugin for your development, open "AndroidManifest.xml" in the Android Manifest Editor (should be the default action for opening androidmanifest.xml from the project files list), select the "Permissions" tab along the bottom of the editor (Manifest - Application - Permissions - Instrumentation - AndroidManifest.xml), then "Add..." a "Uses Permission" and select the desired permission from the dropdown on the right, or just copy paste in the necessary one (such as the "android.permission.INTERNET" permission you required).

Chris
A: 

Hi,

So I cannot find details about this.

I am using internet permissions. On 1.5 phones I need to add a tag also in the application section of the manifest. However if I do this on 2.2 phones it gives another permission exception so I need to take it out when syncing 2.2 phones.

What is going on?

so, <uses-permission> tag always

android.permission attribute inside <application> sections only on 1.5

Thanks

Dorin
Hi Dorin - this isn't actually a forum. If you have a different question than the original, try asking that different question as a whole new topic.
MattK
A: 

In androidmanifest.xml file,

...

when i run this app,it wil display like this,

sorry! this application xmlparsing(process com.android)has stopped unexpectedly.please try again.

can u help me on this.its urgent. thank u.

ankith
ankith, this is not the way you want to use stackoverflow. Try to add value in the answers section. If you have the same problem as the original question, either vote up the question or offer a bounty. If you have a different question, ask that question.
MattK