关于Android权限的获取问题,大家遇到过这样的情况嘛?
PHP中文网
PHP中文网 2017-04-18 09:16:56
0
3
442

大家都知道, 在api23 google加入了动态权限系统,如果我们手机的系统版本大于22以及应用的target version大于22时,某些权限必须通过动态申请的方式获取。

反之,无论是手机版本还是应用的target version低于23,都将在安装时列出需要的权限,如果确定安装则会授予应用在manifest中申请的所有权限。

见 Google 对于动态获取权限的描述

但最近在公司的一个项目上出现了这样的问题:

我手机是AndroidN,项目target version22,安装后却依旧会动态弹出授权窗口,因为项目未做动态权限适配,如果用户授权还好,如果拒绝有些时候就会崩溃掉。
如图:

我的手机是一加3,暂时手头也没有别的机器,所以也不好确定是rom的问题还是其他的什么,所以想问问大家是否也遇到过这样的情况?

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(3)
伊谢尔伦

It is a modification of domestic mobile phones. It will have its own permission management. Basically, domestic mobile phones have it, so the best thing is to use 23 directly and process it directly. Otherwise, you can only judge and control objects and null values.

黄舟

It may be that OnePlus 3 has adapted the permissions part by itself, and Huawei, Meizu, etc. all handle these permission requests themselves.
I also encountered a headache problem before. When using the camera on a Meizu phone, if the user refuses, the Camera object can still be obtained normally and is not empty, and no error is reported. It’s just that Meizu silently calls release for you, which is really a trap

伊谢尔伦

It seems that this customized manufacturer is always used to adding some "new features" to the old version when updating ROMs.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!