仅在定位较低的API时请求对Android M的权限 [英] Request permission on Android M only when targeting lower API

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

问题描述

因此,在我的应用中,我想添加一个选项,以在用户使用Android M时有选择地添加权限(例如,直接拨号),但与此同时,我希望该权限未按要求显示在API 22或更低版本中,仅仅是因为它不是必需的,所以我宁愿在安装过程中不要求它(因此实际上使该功能仅在M上可用).

So in my app i would like to add an option to selectively add a permission (say, direct dial) when the user is on Android M but, at the same time, i would like to have that permission NOT showing as required in API 22 or lower simply because its not essential so i prefer not asking for it during install (so de facto making that feature available on M only).

因此,我了解M的新模型是,当用户使用M时,它将允许可选权限,而使用较低API时,它将使那些权限成为强制性.那么,有什么已知的方法可以删除低于23的API上的那些权限?没有单独的口味/APK?

So, i understand the new model of M is that it will allow optional permissions when user is on M and it will make those permissions mandatory when on lower APIs. So is there any known way to just remove those permissions on API lower than 23? Without having separate flavours / APK?

也许当API> 22时,将清单与这些行合并?还是有更清洁的解决方案?

Maybe merging a manifest with just those lines when API is > 22 ? Or there is a cleaner solution?

推荐答案

这是可能的.阅读文档时,会有一个特殊标记仅表示M.

This is possible. When reading the documentation there is a special flag to indicate for M only.

使用

<uses-permission-sdk23>

仅对棉花糖设备应用许可.

to apply permission for Marshmallow devices only.

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

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