What permission do I need to access Internet from an Android application?


Question

I get the following Exception running my app:

java.net.SocketException: Permission denied (maybe missing INTERNET permission)

How do I solve the missing permission problem?

1
578
10/11/2018 4:17:07 AM

Accepted Answer

Update:
Google removed the need to ask permission for the internet for the latest version of Google Play.

Add the [INTERNET][1] permission to your manifest file.

You have to add this line:

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

outside the application tag in your AndroidManifest.xml

[1]: https://developer.android.com/training/basics/network-ops/connecting.html

1201
6/17/2019 5:45:39 AM

In the latest release of Google Play, Google removed the need to ask permission for internet as "most apps need it anyways nowadays". However, for users who have older versions, it is still recommended to leave the code below in your manifest

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

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon