首页 > 解决方案 > 请求互联网许可不起作用

问题描述

我正在尝试使用 SDK 26 在我的 android 手机上的我的 android 应用程序中请求互联网许可。我尝试使用AndroidManifest.xml,我尝试使用ActivityCompat.requestPermissions(this, new String[]{ Manifest.permission.INTERNET }, 1);并且我尝试了不同的请求代码。我已经在onCreate按钮按下事件中和内部进行了尝试,但是当我进入应用程序信息时仍然没有显示权限。

我完全迷失了,因为我看不出有任何理由为什么这不起作用。有任何想法吗?我还不知道的常见问题?

andoidManifest.xml

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

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

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

</manifest>

标签: androidandroid-permissions

解决方案


权限分为几个保护级别

影响第三方应用程序的保护级别有三个:正常签名危险权限

INTERNET权限处于正常保护级别,这就是为什么不需要在运行时询问

在这里查看列表

什么是正常危险的许可?

正常

对用户不敏感和有害的权限,例如。像振动互联网

危险

敏感和有害的权限,如允许READ_CONTACTS后,应用程序可能会滥用您的联系人详细信息或允许READ_EXTERNAL_STORAGE访问您的 SD 卡数据


推荐阅读