未请求Android权限 [英] Android permissions not being requested

查看:110
本文介绍了未请求Android权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的AndroidManifest.xml中设置了我的权限,没有错误,但是在设备上进行测试时,不需要该权限.

I have my permissions set in my AndroidManifest.xml with no errors, yet when testing is on my device, the permissions are not requested.

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


    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme" >

    <activity
        android:name=".MainActivity"
        android:label="login">


        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name=".AddressActivity"
        android:label="GPS">

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

</manifest>

推荐答案

这里首先要注意的是,不再在安装应用程序时询问Android权限,而是在应用程序必须使用它们时才询问.看到一个对话框,询问您是否批准Android 6+的某些权限.另一个注意事项是,权限分为两类:

First thing to note here is that Android permissions are no longer asked when the app is installed, but rather when the app has to use them so, you will never see a dialog asking to approve some permissions from Android 6+. Another note is that the permissions are divided into 2 categories:

  • 正常(无需征求他们的许可)并在安装应用后由系统自动授予),包括android.permission.INTERNET;
  • 危险(您必须明确要求他们),包括具有访问用户私人信息或数据的任何权限.
  • Normal (no need to ask permission for them and are automatically granted by the system when the app is installed), including android.permission.INTERNET;
  • Dangerous (you have to explicitly ask for them), including any permission that has access to user private information or data.

在您的情况下,INTERNET的权限将在安装应用程序时由系统授予,而不会通知用户,但是LOCATION的权限仅在您的应用程序使用与此功能相关的某些功能时才会显示(不要求他们将很可能使应用程序崩溃).

In your case, the permission for INTERNET will be granted by the system when the app is installed, without notifying the user, but the permission for LOCATION will appear only when your app will use some functionality regarding this feature (not asking for them will most likely crash the app).

这篇关于未请求Android权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆