If your application requires internet connection then you need to add permissions to the manifest file AndroidManifest.xml. If you don't do this then your app may crash throwing an exception.
Steps to Add Internet Permissions to Manifest file
Locate your AndroidManifest.xml file in your project folder,
![AndroidManifest_xml.png AndroidManifest_xml.png](https://code2care.org/pages/adding-internet-permission-to-android-project/images/AndroidManifest_xml.png)
AndroidManifest_xml.png
Now you can see tabs at the lower side of the Manifest, click on Permissions,
![Select Permissions.png Select Permissions.png](https://code2care.org/pages/adding-internet-permission-to-android-project/images/Select Permissions.png)
Select Permissions.png
Now click on "Add" to add a new element to manifest file.
Select User Permission,![Select Users Permission.png Select Users Permission.png](https://code2care.org/pages/adding-internet-permission-to-android-project/images/Select Users Permission.png)
Select Users Permission.png
Now you would see Name filed, select: android.permission.INTERNET, You can leave the Max SDK version as blank, but you can set a max API level as say 5.
![Add android_permission_INTERNET.png Add android_permission_INTERNET.png](https://code2care.org/pages/adding-internet-permission-to-android-project/images/Add android_permission_INTERNET.png)
Add android_permission_INTERNET.png
Now if you see the XML view, you would see,
<uses-permission android:name="android.permission.INTERNET" /> being added below user-sdk tag.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.internetEg"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
More Posts related to Android,
- Increase Android Emulator Timeout time
- Android : Remove ListView Separator/divider programmatically or using xml property
- Error : Invalid key hash.The key hash does not match any stored key hashes
- How to Change Android Toast Position?
- Android Alert Dialog with Checkboxes example
- Android : No Launcher activity found! Error
- Android Development: Spinners with Example
- Failed to sync Gradle project Error:failed to find target android-23
- INSTALL_FAILED_INSUFFICIENT_STORAGE Android Error
- Disable Fading Edges Scroll Effect Android Views
- How to create Toast messages in Android?
- Channel 50 SMSes received every few minutes Android Phones
- Android xml error Attribute is missing the Android namespace prefix [Solution]
- Create Custom Android AlertDialog
- How To Disable Landscape Mode in Android Application
- Android Development - How to switch between two Activities
- incorrect line ending: found carriage return (\r) without corresponding newline (\n)
- Generate Facebook Android SDK keyhash using java code
- Android Error Generating Final Archive - Debug Certificate Expired
- 21 Useful Android Emulator Short-cut Keyboard Keys
- Android RatingBar Example
- 11 Weeks of Android Online Sessions-15-Jun-to-28-Aug-2020
- Download interrupted: Unknown Host dl-ssl.google.com Error Android SDK Manager
- fill_parent vs match_parent vs wrap_content
- Android : Connection with adb was interrupted 0 attempts have been made to reconnect
More Posts:
- [fix] AWS S3 make_bucket failed: An error occurred (InvalidBucketName) when calling the CreateBucket operation. - S3
- cURL -x Use of HTTP Proxy Server Examples - cURL
- Create Safari Shortcut on Mac Desktop - MacOS
- How to Get the Current Date and Time in Java 8 and Above - Java
- Java: Convert Stream to List - Java
- [Fix] zsh: command not found: awscli [Mac Terminal] - AWS
- 11 Weeks of Android Online Sessions-15-Jun-to-28-Aug-2020 - Android
- How to reload zsh shell profile file? - zsh