Working on an Android app that requires internet permission?

This post shows how to add internet permission in Android Studio. If you are developing an app that requires internet access.

Android Mainifest

Locate the Android Manifest xml file by navigating to.

app -> src -> main -> AndroidManifest.xml.

Add the Following Code to Android Manifest

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

Completed Android Manifest File

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

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

    <application
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.MyApplication"
        android:usesCleartextTraffic="true"
        tools:targetApi="31">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:label="@string/app_name"
            android:theme="@style/Theme.MyApplication">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

Now we have added internet permission in AndroidManifest.xml. Your android application will be able to access the internet.


Russell Morley

Test Lead | Software Developer In Test | Automation Enthusiast