[英]Maximum Android permissions in AndroidManifest.xml
Adding a lot of permissions doesn't cause problems, as far as I know.据我所知,添加大量权限不会引起问题。 So why a developer should not be asking for all the available permissions, Including unnecessary ones?
那么为什么开发人员不应该要求所有可用的权限,包括不必要的权限?
I noticed that Android doesn't ask for the user's permissions for some of the permissions.我注意到 Android 并没有要求用户获得某些权限。 What's the reason for that?
这是什么原因?
You must follow the Permissions best practices.您必须遵循权限最佳实践。
You must specify in your Manifest only the permissions that you need.您必须在您的清单中仅指定您需要的权限。 If you ask for not necessary ones or too many then users will most likely remove your app even before they fully run it.
如果您要求不必要的或太多,那么用户很可能会在他们完全运行之前删除您的应用。
Is better to request each Permission or group of Permissions whenever is first needed.最好在第一次需要时请求每个权限或权限组。 Though, if it's just a couple of permissions probably you can ask for them right away at start time.
不过,如果它只是几个权限,您可能可以在开始时立即请求它们。
The fact that a Permission is declared in the Manifest doesn't mean it is Granted, it only means that the app will require it.在清单中声明权限的事实并不意味着它被授予,这仅意味着应用程序将需要它。 And yes, you still need to ask each to be granted.
是的,您仍然需要要求每个人都被授予。
A practical example.一个实际的例子。 A camera app:
一个相机应用程序:
This may sound at first glance like a lot of requests at different points, but this is how is specified by the best practices.乍一看,这听起来像是在不同点有很多请求,但这就是最佳实践所指定的方式。 Permissions should be requested in a way that doesn't overwhelm the user.
应以不会让用户不知所措的方式请求权限。
More details in next link: https://developer.android.com/training/permissions/usage-notes下一个链接中的更多详细信息: https : //developer.android.com/training/permissions/usage-notes
And a final clarification.以及最后的澄清。 If a specific API call requires a permission which isn't granted, then an Exception will be thrown at the moment that such API call gets executed.
如果特定的 API 调用需要未授予的权限,则在执行此类 API 调用时将抛出异常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.