requestPermissions 请求权限 (中文翻译小组)

本文详细介绍了Android从API 23开始引入的requestPermissions方法,用于在运行时请求权限。权限分为Signature和Normal两种类型,必须在清单文件中声明。用户接受或拒绝权限后,应用会接收到回调。注意请求权限不保证会被授予,应用应能无权限正常运行。了解此方法对于实现动态权限管理至关重要。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

requestPermissions  请求权限方法

Added in API level 23

该权限从API 23开始新增

public final void requestPermissions (String[] permissions, 
                int requestCode)

public final void requestPermissions (String[] 请求权限数组, int 请求代码)

 

Requests permissions to be granted to this application.

请求授予此应用程序的权限。

These permissions must be requested in your manifest,

这些权限必须在您的清单中请求,

 

they should not be granted to your app, and they should have protection level dangerous,

不应授予您的应用程序,并且它们应该具有危险的保护级别,

regardless whether they are declared by the platform or a third-party app.

无论它们是由平台还是第三方应用程序声明的。


Signature permissions PermissionInfo.PROTECTION_SIGNATURE are granted at install time if requested in the manifest and the signature of your app matches the signature of the app declaring the permissions.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值