在本教程中,我们将看到如何在Android Studio中添加Internet权限。
当我们在想要访问Internet的应用程序时,我们需要在Androidmanifest.xml中添加另外权限,否则应用程序将无法访问Internet。因此,我们需要在Androidmanifest.xml文件中放入以下代码以访问应用程序中的Internet。
<uses-permission android:name=
"android.permission.INTERNET"
我们需要为用户安全添加此权限。每当我们从播放商店下载应用程序时,它会要求使用应用程序将使用的权限。让我们说你正在下载一份不得使用Internet的应用程序,如果我们不需要任何权限,则可能暗中将数据置于某些服务器上。我们需要在Androidmanifest.xml中明确地将Internet权限放在androidmanifest.xml中,因此应用程序的用户将意识到它。
转到APP - > SRC - > Main - > AndroidManifest.xml。
复制以下代码:
把它放在androidmanifest.xml中
<?xml version=
"1.0"
encoding=
"utf-8"
?>
<manifest xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"com.igiftidea.helloworldapp"
>
<application
android:allowBackup=
"true"
android:icon=
"@mipmap/ic_launcher"
android:label=
"@string/app_name"
android:supportsRtl=
android:theme=
"@style/AppTheme"
<activity android:name=
".HelloWorldActivity"
<intent-filter>
<action android:name=
"android.intent.action.MAIN"
<category android:name=
"android.intent.category.LAUNCHER"
<
/intent-filter
/activity
/application
/manifest
原文链接:https://codingdict.com/