在运行时是否需要Internet许可请求

在运行时是否需要Internet许可请求

本文介绍了在运行时是否需要Internet许可请求(Android)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于Android,要求我们在运行时询问权限,以确保用户更好地理解了何时需要权限.我知道这对于WRITE_CALENDARACCESS_FINE_LOCATION之类的权限是正确的,但似乎对于INTERNET并不是必需的.并不奇怪,因为几乎所有应用程序都使用互联网.

For Android, it is required that we ask permissions at runtime to make sure users understand better why en when permissions are needed. I know this is true for permissions like WRITE_CALENDAR and ACCESS_FINE_LOCATION but it seems it's not required for INTERNET. Not strange because almost all apps use internet.

可以肯定地说我只需要在清单中声明它吗?

Is it safe to say that I only need to declare it in the manifest?

<uses-permission android:name="android.permission.INTERNET" />

还是我应该始终在运行时检查它?

Or should I always check it at runtime?

推荐答案

不,您不应该在运行时请求INTERNET权限.

No, you shouldn't ask for INTERNET permission at runtime.

INTERNET属于普通权限组,该组自动由系统,如果它们在清单中声明,如本文档中所述:

INTERNET belongs to the Normal permissions group, which are automatically granted by the system if they're declared in the Manifest, as mentioned in this document:

这篇关于在运行时是否需要Internet许可请求(Android)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 04:56