Add Permissions to the App Manifest
This section outlines how to add permissions to the App Manifest (AndroidManifest.xml) file. This permission mentioned enables your app to use the internet.
The App Manifest contains crucial information about your app (components such as activities, services, receivers, content providers, intent messages, processes, permissions, APIs, classes, minimum versions and libraries) and communicates this to the Android system to enable Android to run your code.
To add permissions to the App Manifest
- From Android Studio, open your project.
- Navigate to the app folder, then from src > main folder, locate your AndroidManifest.xml file.
- Just above the Application tag, add these two lines of code:
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
With the release of Android Marshmallow, Android switched from an install-time to a runtime permissions model. In any case, both are granted automatically if listed in the App Manifest.