android - 我可以跳过询问棉花糖的运行时权限吗?

标签 android android-6.0-marshmallow android-version android-security runtime-permissions

现在这对我来说非常有趣,我最了解运行时权限并且我很清楚为什么建议运行时权限?我们如何使用它?但在 this question这是关于由于运行时权限问题而出现的问题,有人提出了一种解决此问题的新方法。

参见 U.swap对同一问题的回答,here是那个答案。

这个人提出了一个很好的工作解决方案,用户只需批准一次权限,在他的余生中,他不必担心所有运行时权限,应用程序将在棉花糖版本上运行和评论中讨论的棉花糖前版本请参阅我和 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在答案上或看下面的图片

Discussion comments

最佳答案

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/

相关文章:

android - 在 Marshmallow 上以编程方式安装 APK

android - 无法实例化 Activity ComponentInfo

java - 您可以限制特定的 Android API 版本从 googlePlay 商店运行/下载应用程序吗?

android - 在高于 4.4 的 Android 操作系统版本中,无法使用 Canvas 绘制线条

android - Android中ViewTreeObserver.OnGlobalLayoutListener什么时候通知

android - 如何使用 Retrofit 解析 JSON 数组?

android - 如何通过代码检测Android上的表情符号支持

android - 后台服务的报警管理器

android - onBeginningOfSpeech() 是本地触发还是服务器触发?

android - SmsMessage.createFromPdu 在 android API 级别 23 中被弃用