现在这对我来说非常有趣,我最了解运行时权限并且我很清楚为什么建议运行时权限?和我们如何使用它?但在 this question这是关于由于运行时权限问题而出现的问题,有人提出了一种解决此问题的新方法。
这个人提出了一个很好的工作解决方案,用户只需批准一次权限,在他的余生中,他不必担心所有运行时权限,应用程序将在棉花糖版本上运行和评论中讨论的棉花糖前版本请参阅我和 Commonsware 之间讨论的所有评论.
@NiteshPareek: There is nothing about this answer that prevents the app from running on Android 6.0+ devices -Commonsware
但这意味着我们可以购买运行时权限所提出的安全性? @CommonsWare – Tapan parmar
@Tapanparmar: No, as users can manually revoke permissions in Settings. Having targetSdkVersion 22 or lower means that your app is not going to have any runtime permission code, so the user needs to agree to your requested permissions at install time. This is how Android worked from the beginning. – CommonsWare
好的,所以应用程序可以在不显示权限的情况下在 marshmallow 上运行? @CommonsWare - Tapan Parmar
@Tapanparmar: The user will be presented with permissions at the time the app is installed. – CommonsWare
好吧,我们可以跳过由此提供的该死的权限,但是这样做有什么缺点吗? @CommonsWare
@Tapanparmar: Users may elect not to install your app, if they do not like granting all the permissions up front. Also, other behaviors that you might want based on higher targetSdkVersion values may be lost. If you have additional concerns, please ask a separate Stack Overflow question. – CommonsWare
所以我想知道这样做有什么实际缺点吗? 安全性 会怎样,这是RunTimePermissions 的主要目的。 这样做真的更好吗?
查看评论here在答案上或看下面的图片
最佳答案
are there any actual drawbacks of doing this?
如果用户不喜欢预先授予所有权限,他们可能会选择不安装您的应用。此外,您可能需要的其他行为基于更高的 targetSdkVersion
值可能会丢失。
And what will happen to security which was main purpose of RunTimePermissions
没有。您仍然需要所有 <uses-permission>
元素,并且用户仍然必须同意授予您权限。但是,该协议(protocol)主要发生在安装时,而不是应用程序运行时。请记住,Android 6.0+ 设备的用户仍然可以撤销 dangerous
- 通过“设置”应用获得级别权限。
And is it really preferable to do this?
恕我直言,不。最终,某些事情会迫使您采取行动并要求您升级 targetSdkVersion
.而且,正如我所指出的,用户可能更愿意不安装您的应用程序,而选择其他一些在安装时不需要太多权限的应用程序。使用 targetSdkVersion
对于不再维护的应用程序或没有经验的开发人员,低于 23 是一个很好的答案。
关于android - 我可以跳过询问棉花糖的运行时权限吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38411785/