How to add manifest permission to an application?

rob picture rob · Jan 30, 2010 · Viewed 775.3k times · Source

I am trying to access HTTP link using HttpURLConnection in Android to download a file, but I am 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 it's still giving the same exception.

Answer

Anthony Forloney picture Anthony Forloney · Jan 30, 2010

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

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

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