当前位置:网站首页>Contextcompat. Checkselfpermission() method
Contextcompat. Checkselfpermission() method
2022-07-27 01:07:00 【Roy_ chen7】
ContextCompat Class checkSelfPermission Method is used to detect whether a user has authorized a certain permission .
checkSelfPermission() Method needs to pass two parameters , The first parameter needs to be passed in Context, The second parameter needs to pass in the permission to be detected , Such as the authority to make calls :Manifest.permission.CALL_PHONE. The return value of the method is -1(PackageManager.PERMISSION_DENIED) perhaps 0(PackageManager.PERMISSION_GRANTED). If the return value is GRANTED Is authorized , Otherwise, you need to apply for authorization .
example :
ContextCompat.checkSelfPermission(MainActivity.this,
Manifest.permission.CALL_PHONE) = PackageManager.PERMISSION_GRANTED // If equal, it is authorized It is important to note that in AS Inside, choose Manifest Then click Alt+Enter, Two prompts will appear , One is to introduce Manifest(java.util.jar), The other is to introduce Manifest(android), Need here import Yes. Manifest(android) My bag , Otherwise, it will report a mistake :cannot resolve 'permission'
边栏推荐
- [SQL注入] 联合查询
- Neo4j Basic Guide (installation, node and relationship data import, data query)
- 腾讯升级视频号小程序直播功能,腾讯持续推广直播的底气是这项叫视立方(MLVB)的技术
- 不止直播:腾讯云直播MLVB 插件除了推流/拉流还有哪些亮眼功能
- [NPUCTF2020]ezinclude
- 2022.7.10DAY602
- 基于Flink实时项目:用户行为分析(一:实时热门商品统计)
- Flink based real-time project: user behavior analysis (I: real-time popular product statistics)
- MYSQL分表DDL操作(存储过程)
- 基于Flink实时项目:用户行为分析(三:网站总浏览量统计(PV))
猜你喜欢
随机推荐
腾讯云MLVB技术如何在移动直播服务中突出重围之基础概念
flink1.11 sql本地运行demo & 本地webUI可视解决
DataNode Decommision
深度学习报告(3)
Status management in Flink
Uni-app 小程序 App 的广告变现之路:Banner 信息流广告
Neo4j基础指南(安装,节点和关系数据导入,数据查询)
Spark累加器(Accumulator)
基于Flink实时项目:用户行为分析(一:实时热门商品统计)
MySql - 如何确定一个字段适合构建索引?
当事务遇上分布式锁
分区的使用及案例
Essay - I say you are so cute
[ciscn2019 southeast China division]double secret
腾讯云直播插件MLVB如何借助这些优势成为主播直播推拉流的神助攻?
07 - 日志服务器的搭建与攻击
mermaid
flink需求之—SideOutPut(侧输出流的应用:将温度大于30℃的输出到主流,低于30℃的输出到侧流)
(Spark调优~)算子的合理选择
logback自定义MessageConverter



![[HarekazeCTF2019]encode_ and_ encode](/img/f5/c06523a1764717bdf2d91f069c9d77.png)





![[hongminggu CTF 2021] write_ shell](/img/f5/c3a771ab7b40311e37a056defcbd78.png)